Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Apr 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Mail Anomaly - Possibly blatantly obvious to the trained eye

    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

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    It's simple. Need to do:

    PHP Code:
            $headers .= "From: ".$sitename1." <helpdesk@website.com> \r\n"
    BTW, try not to use shorttags. Use <?php instead of <?

  • #3
    New Coder
    Join Date
    Apr 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Nightfire
    It's simple. Need to do:

    PHP Code:
            $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.

  • #4
    Regular Coder
    Join Date
    Mar 2006
    Location
    Connecticut, USA
    Posts
    400
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •