Jack_mcs, on 10 January 2006, 14:07, said:
Hmm, I don't know what to tell you. It all works fine so it must be server specific. The program uses a mail class to send the emails. Maybe there is something in there that is causing this. The following code is taken from the email function in oscommerce. You can add the following to the bottom of the file, replacing the line
$tmessage->Send();
with
$headers = 'MIME-Version: 1.0' . "\r\n";$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";$headers .= 'test@yahoo.com' . "\r\n";$headers .= 'test@yahoo.com' . "\r\n";mail($to, 'test', $message, $headers);
If the mail is received properly, then it is the mail class.Jack
Since I was having problems with html, you suggested replacing the line
$tmessage->Send();
with
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'test@yahoo.com' . "\r\n";
$headers .= 'test@yahoo.com' . "\r\n";
mail($to, 'test', $message, $headers);
back in 2006, more in post 73. Therefore my code was like this:
// Mail it
$tmessage->SetHtmlContent($message);
$serverFileMimeType = 'text/html';
$tmessage->SetFileContent($pathToServerFile, $serverFileMimeType);
// $tmessage->Send();
// changed to \n instead of \r\n below - otherwise no html - mr_absinthe
$headers .= 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n";
$headers .= "From: ". $Name . " <" . $email . ">\n";
mail($Recipiant, $Subject, $message, $headers);
Therefore inserting
$tmessage->Clear();
did not help.
After reverting it back to the original and inserting the line, all seems to be fine, the code now looks:
// Mail it
$tmessage->SetHtmlContent($message);
$serverFileMimeType = 'text/html';
$tmessage->SetFileContent($pathToServerFile, $serverFileMimeType);
$tmessage->Send();
$tmessage->Clear();
AND THE PROBLEM IS GONE!!! THANK YOU!!! And I hope that this post can help someone as well.
I also wanted to modify the $Sender - the "From:" field is showing the email address only at the moment, I've therefore modified the code in auto_emailer.php
//Set some common items
$Name = 'My Store';
$email = 'info@mystore.com';
$Sender = ''. $Name . ' <' . $email . '>';
$Recipiant = '';
$Cc = '';
$Bcc = '';
$currentDate = date('Y-m-d');
However it doesn't work, the "From:" field is still showing email address only. As you can see above, it was working fine with $headers.