#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    27
    Rep Power
    0
    Hi:

    I've been trying to send HTML-rich mail using the mail() function, and as long as I enter something in the 'additional_headers' field of the function, it works... but when I send anonomous mail, the HTML tags are displayed as text.

    CODE:
    -----
    //$ra = recipient's addy
    //$rn = recipient's name
    //$sa = sender's addy
    //$sn = sender's name
    if ($rn)
    $to = $rn." <".$ra.">";
    else
    $to = $ra;

    if ($sa)
    if ($sn)
    {
    $from = "From: ".$sn."<".$sa.">"."nMIME-Version: 1.0"."nContent-Type: text/html; charset=iso-8859-1"."nContent-Transfer-Encoding: 8bit";
    }
    else
    {
    $from = "From: ".$sa."nMIME-Version: 1.0"."nContent-Type: text/html; charset=iso-8859-1"."nContent-Transfer-Encoding: 8bit";
    }
    else
    {
    $from = "From: ".$ra."nMIME-Version: 1.0"."nContent-Type: text/html; charset=iso-8859-1"."nContent-Transfer-Encoding: 8bit";
    }

    ////mime////
    $message = "<html><body>".$message."</body></html>";

    if ($sa)
    if (mail($to, $subject, $message, $from))
    print "letter #".$i." has been delivered.<BR>";
    else
    print "ergh, letter #".$i." didn't send.<BR>";
    else
    if (mail($to, $subject, $message))
    print "letter #".$i." has been delivered.<BR>";
    else
    print "ergh, letter #".$i." didn't send.<BR>";
    ---------------------------


    thank you
    //ryan
  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    Perth West Australia
    Posts
    757
    Rep Power
    15
    Not sure what the problem is .... but you can workaround (I do this all the time!) by adding defaults, ie:

    <? if(!$ra){$ra="anonomous";}?>

    So you get something even if they give you nothing.

    ------------------
    Simon Wheeler
    FirePages -DHTML/PHP/MySQL
  4. #3
  5. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    <<
    if ($sa)
    if ($sn)
    {
    $from = "From: ".$sn."<".$sa.">"."nMIME-Version: 1.0"."nContent-Type: text/html; charset=iso-8859-1"."nContent-Transfer-Encoding: 8bit";
    }
    else
    {
    $from = "From: ".$sa."nMIME-Version: 1.0"."nContent-Type: text/html; charset=iso-8859-1"."nContent-Transfer-Encoding: 8bit";
    }
    else
    {
    $from = "From: ".$ra."nMIME-Version: 1.0"."nContent-Type: text/html; charset=iso-8859-1"."nContent-Transfer-Encoding: 8bit";
    }

    >>


    just try this:


    if (isset($sa)){
    if (isset($sn)){
    $from = "From: $sn<$sa>n";
    }else{
    $from = "From: $san";
    }
    }else{
    $from = "From: $ran"
    }

    $from.= "MIME-Version: 1.0n";
    $from.= "Content-Type: text/html; charset=iso-8859-1n";
    $from.= "Content-Transfer-Encoding: 8bitn";

    Good Luck!!


    ------------------
    SR -
    webshiju.com

    "The fear of the LORD is the beginning of knowledge..."

    [This message has been edited by Shiju Rajan (edited August 11, 2000).]
  6. #4
  7. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    <<
    Not sure what the problem is .... but you can workaround (I do this all the time!) by adding defaults, ie:
    <? if(!$ra){$ra="anonomous";}?>
    >>

    that is a good idea.probably your $ra is not passing any value to "From".



    ------------------
    SR -
    webshiju.com

    "The fear of the LORD is the beginning of knowledge..."

Similar Threads

  1. free hosting allow mail() function
    By playboy in forum Free Web Hosting
    Replies: 8
    Last Post: June 27th, 2005, 05:53 PM
  2. Uploading Files
    By vivekjain in forum ASP Programming
    Replies: 0
    Last Post: February 16th, 2004, 11:21 PM
  3. Help with script
    By akastarlight in forum Perl Programming
    Replies: 1
    Last Post: February 6th, 2004, 06:55 AM
  4. mail() function dropping characters
    By Webbywarehouse in forum PHP Development
    Replies: 2
    Last Post: January 28th, 2004, 01:42 PM
  5. mail function smtp problem
    By emzyme in forum PHP Development
    Replies: 3
    Last Post: January 25th, 2004, 06:59 PM

IMN logo majestic logo threadwatch logo seochat tools logo