Jump to content

Simple email form


sandbudd

Recommended Posts

I am wanting the name to appear in the from in the email.... This is what I am getting [email protected] which I know is my server... Im not sure what I need to do?

 

<?php
$headers = 'From: '.$name."\r\n";
$msg = "From:\n" .$_POST['name']."\n\n";
$msg .= "Address:\n".$_POST['address']."\n\n";
$msg .= "Suite:\n".$_POST['suite']."\n\n";
$msg .= "City:\n".$_POST['city']."\n\n";
$msg .= "State:\n".$_POST['state']."\n\n";
$msg .= "Zip Code:\n".$_POST['zip']."\n\n";
$to = "[email protected]";
$subject = "Website Request";
$result = mail($to, $subject, $msg, $headers);
?>

Link to comment
https://forums.phpfreaks.com/topic/205860-simple-email-form/
Share on other sites

I always thought for emails to work correctly, they need a from email address .... I.e. [email protected], not just a name, and that is probably why your server is inputting it's own email address...

 

I could be wrong, but I think you may need to set it up so that it comes from any email, like [email protected] -- also helps anyhow to take care of spam problems, that is, so you're not seen as a spammer ....

Link to comment
https://forums.phpfreaks.com/topic/205860-simple-email-form/#findComment-1077237
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.