O'Reilly Forums: Chapter 1 - Page 51 - O'Reilly Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Chapter 1 - Page 51 The email that never arrived...

#1 User is offline   PhilipHarper 

  • New Member
  • Pip
  • Group: Members
  • Posts: 5
  • Joined: 09-July 14
  • Gender:Male
  • Location:London, England
  • Interests:Surfing, Snowboarding, Hiking. Learning new stuff!

Posted 10 July 2014 - 04:30 AM

Hello,

I've uploaded my form to my website, I fill out the form, I get the complete echo of the form and everything looks great but the email never arrives?

I have checked the email address, the spam / junk folders everything. Even changed the email address to send to but still no joy...?

Anyone got any ideas?

Here's my code...

<html>
<head>
<title>Aliens Abducted Me - Report and Abduction</title>
</head>
<body>
<h2>Aliens Abducted Me - Report an Abduction</h2>


<?php

$name = $_POST['firstname']. ' ' .$_POST['lastname'];
$when_it_happened = $_POST['whenithappened'];
$how_long = $_POST['howlong'];
$how_many = $_POST['howmany'];
$alien_description = $_POST['aliendescription'];
$what_they_did = $_POST['whattheydid'];
$fang_spotted = $_POST['fangspotted'];
$other = $_POST['other'];
$email = $_POST['email'];

$to = 'fillupharper@googlemail.com';
$subject = 'Aliens Abducted Me - Abduction Report';
$msg = "$name was obducted $when_it_happened and was gone for $how_long.\n" .
"Number of aliens: $how_many\n" .
"What they did: $what_they_did\n" .
"Fang spotted? $fang_spotted\n" .
"Other comments: $other";

mail($to, $subject, $msg, 'From:' . $email);


echo 'Thanks for submitting the form ' . $name . '<br />';
echo 'You were abducted ' . $when_it_happened;
echo ' and were gone for ' . $how_long . '<br />';
echo 'Number of aliens ' . $how_many . '<br />';
echo 'Describe them: ' . $alien_description . '<br />';
echo 'The aliens did this:' . $what_they_did . '<br />';
echo 'Was Fang there? ' . $fang_spotted . '<br />';
echo 'Other comments: ' . $other . '<br />';
echo 'Is this your email address? ' . $email . '<br />';

?>

</body>
</html>



Thanks for your help!
[sup][url="http://www.philipharper.info"]Here's my Graphic Design portfolio[/url][/sup]
0

#2 User is offline   PhilipHarper 

  • New Member
  • Pip
  • Group: Members
  • Posts: 5
  • Joined: 09-July 14
  • Gender:Male
  • Location:London, England
  • Interests:Surfing, Snowboarding, Hiking. Learning new stuff!

Posted 10 August 2014 - 02:02 PM

I actually solved this one myself.

If you don't put an (any made-up will do) email address from after the "From:" some email clients, such as gmail consider the email spam and will block it.

mail($to, $subject, $msg, 'From: <email@example.com>' . $from);




Hope that helps if you have the same problem.



Cheers!
[sup][url="http://www.philipharper.info"]Here's my Graphic Design portfolio[/url][/sup]
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users