Welcome, Guest. Please Login or Register.
March 15, 2025, 04:02:21 PM
Home Help Search Log in Register
News: If you are still using YaBB SE, please consider upgrading to SMF as soon as possible.

YaBB SE Community  |  English User Help  |  English Help  |  Sendmail: Not inseting the "from" in email header « previous next »
Pages: [1] Reply Ignore Print
Author Topic: Sendmail: Not inseting the "from" in email header  (Read 840 times)
theoscarspot.com
Noobie
*
Posts: 30


UH-60 Blackhawk Pilot

Sendmail: Not inseting the "from" in email header
« on: September 05, 2003, 02:18:03 PM »
Reply with quote

YaBB SE Version: 1.5.4
PHP Version:
MySQL Version:
Server Platform: Unix, Linux, or BSD
Link to Forum: http://www.theoscarspot.com

Problem Description:
Hello All,
I have been running the PHP version for some time now with great success.  I have noticed that I am getting a lot of bounced email from the sendmail program becuase it is not inserting the FROM in the email header, and there are a lot of servers out there that see this as spam... and thus will not allow the email.  Can someone tell me where to go edit this so I can include the webmaster's email address in all outgoing email from sendmail?

Thanks

edit:  Here is a copy of the email error message that is beign forwarded to me when the mail does not work.

66.82.4.71 failed after I sent the message.
Remote host said: 550 Body From: is missing or empty
« Last Edit: September 05, 2003, 02:20:03 PM by theoscarspot.com » Logged

Robert
theoscarspot.com
Noobie
*
Posts: 30


UH-60 Blackhawk Pilot

Re:Sendmail: Not inseting the "from" in email header
« Reply #1 on: September 05, 2003, 02:49:23 PM »
Reply with quote

Update:
I just went into the admin section to see if all sendmail functions were affected and it seems that this is the case.  I just went in and sent myself an email through the admin function.  The email arrived but without any sender listed in the from block.  Any help that can be given here would be greatly appreciated.
Logged

Robert
[Unknown]
Global Moderator
YaBB God
*****
Posts: 7830


ICQ - 179721867unknownbrackets@hotmail.com WWW
Re:Sendmail: Not inseting the "from" in email header
« Reply #2 on: September 05, 2003, 09:46:08 PM »
Reply with quote

I think this is a bug I fixed at some point...

Try looking at sendmail() in Subs, and see if you can modify the From: header to be like this:

From: "Me" [email protected]\r\n

-[Unknown]
Logged
theoscarspot.com
Noobie
*
Posts: 30


UH-60 Blackhawk Pilot

Re:Sendmail: Not inseting the "from" in email header
« Reply #3 on: September 06, 2003, 02:33:38 PM »
Reply with quote

i applied the above fix to sendmail, but that just places my return address in the body of the message.  When the email arrives, it is still sent without a return address.  I have searched for "sendmail()" and connot seem to find a thread the applies.  Can you give me a link to that thread?
Logged

Robert
[Unknown]
Global Moderator
YaBB God
*****
Posts: 7830


ICQ - 179721867unknownbrackets@hotmail.com WWW
Re:Sendmail: Not inseting the "from" in email header
« Reply #4 on: September 06, 2003, 07:16:17 PM »
Reply with quote

It seems your server is not properly parsing the From header.  I guess it must not realize that it is part of the headers...

Your old function in Subs.php should look like this:
function sendmail($to, $subject, $message, $from = null)
{
   global $mailtype, $webmaster_email, $modSettings;

   $chunkSize = 50;

   $to_array = (is_array($to) ? $to : array($to));

   if ($from == null)
      $from = $webmaster_email;
   $subject = stripslashes($subject);
   $subject = str_replace(array('"', ''', '&', '<', '>'), array('"', '\'', '&', '<', '>'), $subject);
   $message = stripslashes($message);
   $headers = "MIME-Version: 1.0\r\n";
   $headers .= "From: <$webmaster_email>\r\n";
   $headers .= "Return-Path: $webmaster_email";

   if ($modSettings['mail_type'] == 'sendmail')
      foreach ($to_array as $to)
         $mail_result = mail($to, $subject, $message, $headers);
   else
      smtp_mail($to_array, $subject, $message, $headers);

   return $mail_result;
}


I can't remember properly how I changed it before... but I'll try, and we'll see where we get.

function sendmail($to, $subject, $message, $from = null)
{
   global $mailtype, $webmaster_email, $modSettings, $mbname;

   $to_array = is_array($to) ? $to : array($to);

   if ($from == null)
      $from = $webmaster_email;
   $subject = stripslashes($subject);
   $subject = str_replace(array('"', ''', '&', '<', '>'), array('"', '\'', '&', '<', '>'), $subject);
   $message = stripslashes($message);

   $headers .= 'From: "' . addcslashes(isset($from) ? $from : $mbname, '<>[]()\'\\"') . '" <' . $webmaster_email . ">\r\n";
   $headers .= "Return-Path: $webmaster_email";
   $headers = "MIME-Version: 1.0\r\n";

   if ($modSettings['mail_type'] == 'sendmail')
      foreach ($to_array as $to)
         $mail_result = mail($to, $subject, $message, $headers);
   else
      smtp_mail($to_array, $subject, $message, $headers);

   return $mail_result;
}


Please tell me what this produces.  If you use Outlook, please right click on the message and select "Properties..." and then "Details" and finally "Message Source...".  This will tell you exactly what was sent.

-[Unknown]
« Last Edit: September 06, 2003, 07:18:43 PM by [Unknown] » Logged
theoscarspot.com
Noobie
*
Posts: 30


UH-60 Blackhawk Pilot

Re:Sendmail: Not inseting the "from" in email header
« Reply #5 on: September 07, 2003, 02:04:48 PM »
Reply with quote

Unknown.
This problem has been fixed by the laws of Murphy.  My server was attacked by a hacker outside of the country yesterday.  Was getting denial of service errors all day.  He managed to do great harm to my board and the entire server for that matter.  I managed to backup my SQL and had to do a fresh install of the board.  It is working how it should now.  I believe that this was a problem becuase the previous edition of my board was converted from Gold, cuz on the fresh install I did not have to change a thing... it worked fine from the get go.  Thanks for the time and the effort though.
Logged

Robert
[Unknown]
Global Moderator
YaBB God
*****
Posts: 7830


ICQ - 179721867unknownbrackets@hotmail.com WWW
Re:Sendmail: Not inseting the "from" in email header
« Reply #6 on: September 07, 2003, 09:12:56 PM »
Reply with quote

I hate Murphy's Law.  Sorry to hear that... it's happened to the best of us.

-[Unknown]
« Last Edit: September 07, 2003, 09:13:08 PM by [Unknown] » Logged
Pages: [1] Reply Ignore Print 
YaBB SE Community  |  English User Help  |  English Help  |  Sendmail: Not inseting the "from" in email header « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.048 seconds with 20 queries.