...

View Full Version : Mail Anomaly - Possibly blatantly obvious to the trained eye



Letmos
04-28-2006, 03:00 AM
I recently changed servers; mail used to arrive in the following format:

From; helpdesk@website.com
To; customer@hotmail.com
Subject; Confirmation e-mail from website.com

The e-mail content would be 'correct' HTML as follows:
This message has been sent automatically by the website.com system.

Go to the following URL to continue the signup process at website.com:
Click Here

It now arrives in the following format (where ipowerweb is my hosting service):
From; root@host447.ipowerweb.com
To; customer@hotmail.com
Subject; Confirmation e-mail from website.com

With the content in text format as follows:
Content-type: text/html; charset=iso-8859-1

From: helpdesk@website.com


This message has been sent automatically by the website.com system.<BR><BR>Go to the following URL to continue the signup process at website.com:<BR><a href=website.com/buyers/register.php?check=1&id=customer@hotmail.com'>Click Here</a>

The code is as follows:
<?
session_start();
Class BuyerSignup
{
function BuyerSignup()
{

}
function buyer_signup_mail($email, $sitename)
{
$to=$email;
$subject="Confirmation e-mail from website.com";
$sitename1 ="helpdesk@website.com";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$sitename1."\r\n";
$message="This message has been sent automatically by the website.com system.<BR><BR>Go to the following URL to continue the signup process at website.com:<BR><a href='".$sitename."buyers/register.php?check=1&id=".$email."'>Click Here</a>";
mail($to, $subject, $message, $headers);
$newmessage="A confirmation e-mail has been sent to ".$email.", please follow the link inside to continue the signup process.";
return $newmessage;
}

Apologies if this is easily resolved, but the code didn't change between servers and I'm at a loss, thanks in advance,

Letmos

Nightfire
04-28-2006, 03:40 AM
It's simple. Need to do:



$headers .= "From: ".$sitename1." <helpdesk@website.com> \r\n";


BTW, try not to use shorttags. Use <?php instead of <?

Letmos
04-28-2006, 05:56 AM
It's simple. Need to do:



$headers .= "From: ".$sitename1." <helpdesk@website.com> \r\n";




So I simple replace the line:
$headers .= "From: ".$sitename1."\r\n";

with:
$headers .= "From: ".$sitename1." <helpdesk@website.com> \r\n";

I tried this but the result is unchanged...


BTW, try not to use shorttags. Use <?php instead of <?

Thanks for this adviice.

Letmos.

bustamelon
04-28-2006, 06:47 AM
Your new server uses a different type of line break than the old one. Change all instances of '\r\n' to just '\n'. That will stop the headers from busting out into the body. See, the new server is adding TWO line breaks after each line, and the email client thinks the headers are done as soon as it sees a blank line. Been there. ;) This should solve the FROM problem too, but if it doesn't, try also adding a header for Reply-To and Return-Path, using the same FROM address for both.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum