Jump to content

[SOLVED] Send mail


timmah1

Recommended Posts

I set the $from variable depending on how sent the mail, and I have the $from in the header

 

$from = "Vegas D Sports <[email protected]>";


    $headers = "Content-Type: text/html; charset=\"iso-8859-1\"";
    $headers .= "Content-Transfer-Encoding: 7bit";
    $headers .= "From: $from\r\n"; 

    //options to send to cc+bcc
    $headers .= 'Cc: [email protected]' . "\r\n";
    $headers .= 'Bcc: [email protected]' . "\r\n";


mail($to, $subject, $message, $headers);

 

Right now, the from field always shows up as the server address, not what I have declared.

 

How can I fix this?

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/137356-solved-send-mail/
Share on other sites

give this a shot mate. haven't tested it though.

 

$from = '"Vegas D Sports" <[email protected]>';


    $headers = "Content-Type: text/html; charset=\"iso-8859-1\"";
    $headers .= "Content-Transfer-Encoding: 7bit";
    $headers .= 'From: ' . $from . "\r\n"; 

    //options to send to cc+bcc
    $headers .= 'Cc: [email protected]' . "\r\n";
    $headers .= 'Bcc: [email protected]' . "\r\n";


mail($to, $subject, $message, $headers);

Link to comment
https://forums.phpfreaks.com/topic/137356-solved-send-mail/#findComment-717680
Share on other sites

here's the exact headers i've used in a script that works:

 

$headers  = 'MIME-Version: 1.0' . "\r\n";

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

$headers .= 'FROM: "Your Name" <[email protected]>' . "\r\n";

 

may be it has something to do with that.

 

Link to comment
https://forums.phpfreaks.com/topic/137356-solved-send-mail/#findComment-717701
Share on other sites

$Name = "Da Duder"; //senders name

$email = "[email protected]"; //senders e-mail adress

$recipient = "[email protected]"; //recipient

$mail_body = "The text for the mail..."; //mail body

$subject = "Subject for reviever"; //subject

$header = "From: ". $Name . " <" . $email . ">\r\n";

 

ini_set('sendmail_from', '[email protected]'); //Suggested by "Some Guy"

 

mail($recipient, $subject, $mail_body, $header); //mail command :)

Link to comment
https://forums.phpfreaks.com/topic/137356-solved-send-mail/#findComment-717799
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.