Jump to content

[SOLVED] help with simple mail function


elmas156

Recommended Posts

Hello everyone,

 

I'm creating a mail function with some headers so that the email will display who the sender is but I'm having trouble putting variables in the header so that it will display the name and email address of the sender.  Here's what I have:

$myheaders .= 'Customer Name <[email protected]>' . "\r\n";

 

But I want to add a name and email variable.  I can't get this to work the way I'm trying it.

$myheaders .= '$name <$email>' . "\r\n";

 

What am I doing wrong?

Link to comment
https://forums.phpfreaks.com/topic/125904-solved-help-with-simple-mail-function/
Share on other sites

$myheaders .= 'Customer Name <[email protected]>' . "\r\n";

looks to me like an invalid header

 

Scott.

 

The header works fine in this form, it's only when I attempt to add variables to make the customer name and email address dynamic when it gives me problems.

Try:

$myheaders .= "From: " . $name . " <" . $email . ">" . "\r\n";

 

Make sure that you have your headers correct though.  An example:

 

$myheaders = "MIME-Version: 1.0\r\n";

$myheaders .= "Content-type: text/html; charset=iso-8859-1\r\n";

$myheaders .= "From: " . $name . " <" . $email . ">";

 

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.