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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.