PHP Form to my email


I have a form where I use both HTML and PHP.

The form’s action sends the data to a .php page (all data lists well):

<form id=“blog-submit-form” name=“blog-submit-form” method=“post” action=“essay-submitted-data.php” />

Also, upon Submit, the user is taken to a “Thank You” page (Also works well):

<input type=“submit” name=“submit” value=“Submit” etc… onclick=“‘essay-thankyou.php’)”>

I’ve written the php to send all the collected data to my email:


if(isset($_POST[‘submit’])) {

$subject=“Essay Submission Form”;

$lname = $_POST[‘lname’];

$message="Input from your form.\r
$message .="Last Name: “.$S_lname.”\r

$headers = 'From: '.$email."\r
“.'Reply-To: '.$email.”\r
".‘X-Mailer: PHP/’ . phpversion();

mail($to_address, $subject, $message, $headers); }

echo “<b>” . "Last Name: " . "</b> " . $lname . “<br />”;


The problem is with the line: mail($to_address,…); }

I get a SMTP 554 error. I know the SMTP 554 error means the server isn’t recognizing my email address. The msg in the error also says the host is seeing my email attempt as spam - but it’s not. It says the email needs to be authenticated. I’ve called my server people. The email address was obtained from my server. It’s a domain email (GoDaddy). They don’t know why it’s not recognizing it or what to do (or, at least the one guy I spoke to didn’t know).

If you ask why I have both $message and echo, the echo is for a list in the .php page, and the $message is for a list in the email. I’ve tried it w/o the echo but it still doesn’t send me the email.

Any thoughts?


instead of \r

lol… it was
originally. Then I read where someone suggested changing it from
to \r
. :lol:
neither works… what else can I try?

off the top of my head,

echo $to_address.“<hr />”.$subject.“<hr />”.$message.“<hr />”.$headers;

just to make sure everything’s going in correctly…

Thanks… tried it… still doesn’t work.

Here’s the error msg I get:

“Warning: mail() [function.mail]: SMTP server response: 554 The message was rejected because it contains prohibited virus or spam content in D:\Hosting\7612335\html\myemail-essay-submitted-data.php on line 50”

That’s your SMTP server telling you it can’t send the mail as it thinks it’s spam.

Try using a library such as phpmailer or swiftmailer, might take a while to set up but they’ll make your life a lot easier in the long run.