Jump to content

Sendmail Problem


mcmuney

Recommended Posts

Problem: When email goes out, $from appears To, $email appears under Subject and actual From is blank. I tried modifying the Mail Function by removing $from, but then no email goes out. Any thoughts here???

 

Ideally $myemail should work as From, $email as To

 

 

Include File

	function sendmail($fto,$fsub,$fbody,$ffrom)
{
	$headers  = "MIME-Version: 1.0\r\n"; 
	$headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; 
	$headers .= "From:<$ffrom>\r\n";
	@mail($fto, $fsub, $fbody,$headers);	

}

 

Mail Function

$db->sendmail($from,$email,$subject,$mail_body,$myemail);

 

 

Link to comment
https://forums.phpfreaks.com/topic/67218-sendmail-problem/
Share on other sites

Well look at the arguments you're sending and what you expect.

 

You expect:

sendmail($fto,$fsub,$fbody,$ffrom) = FOUR arguments.

 

You send:

$db->sendmail($from,$email,$subject,$mail_body,$myemail); // FIVE.

 

Well, I tried $db->sendmail($email,$subject,$mail_body,$myemail);, but when I do this, no email goes out.

Link to comment
https://forums.phpfreaks.com/topic/67218-sendmail-problem/#findComment-338155
Share on other sites

I've modified the code somewhat to be:

 

$headers  = "MIME-Version: 1.0\r\n"; 
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; 
$headers .= "From:<$myemail>\r\n";
mail($email, $subject, $mail_body, $headers);

 

$email seems to be the problem (if I replace $email with a single email address, it works, if I move $email in the subject spot, it sends all emails to single to address with email being displayed in the subject header), so the problem is $email in the to spot, any ideas?

$arremail = explode(",",$to);
for($i=0;$i<count($arremail);$i++)
{
$email = $arremail[$i];

Link to comment
https://forums.phpfreaks.com/topic/67218-sendmail-problem/#findComment-338426
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.