SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Zealot asrasrasr's Avatar
    Join Date
    Apr 2009
    Posts
    107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Php email with bold text

    hello friends,

    i tring to send email using following code:

    Code PHP:
    $to_email = 'somebody@example.com'; 
     
    $headers =  "To: The Receiver <recipient@some.net>\n" .
        "From: The Sender <sender@some.net>\n" .
        "MIME-Version: 1.0\n" .
        "Content-type: text/html; charset=iso-8859-1";
     
    $subject = 'Subject';
     
    $body = '<html><body><p>Your <i>message</i> here.</p></body></html>';
     
    mail($to_email, $subject, $body, $headers);

    but i dont get ant any email .


    but code working perfectly


    $to_email = 'somebody@example.com';

    $headers = "From: The Sender <sender@some.net>\n";

    $subject = 'Subject';

    $body = 'Your message here.';

    mail($to_email, $subject, $body, $headers);

    Where i m wrong in first code. i want bold text in my email

  2. #2
    SitePoint Addict Zarin Denatrose's Avatar
    Join Date
    Jan 2009
    Location
    Surrey BC, Canada
    Posts
    309
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you got an SMTP server set up?

  3. #3
    SitePoint Zealot asrasrasr's Avatar
    Join Date
    Apr 2009
    Posts
    107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I m not confirm abut smtp. but this yes. because

    $to_email = 'somebody@example.com';

    $headers = "From: The Sender <sender@some.net>\n";

    $subject = 'Subject';

    $body = 'Your message here.';

    mail($to_email, $subject, $body, $headers);

    this code working perfectly.
    but this not working html or bold.

  4. #4
    SitePoint Addict Zarin Denatrose's Avatar
    Join Date
    Jan 2009
    Location
    Surrey BC, Canada
    Posts
    309
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try using \r\n instead of \n.

  5. #5
    SitePoint Zealot asrasrasr's Avatar
    Join Date
    Apr 2009
    Posts
    107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i have used but no success

  6. #6
    SitePoint Addict Zarin Denatrose's Avatar
    Join Date
    Jan 2009
    Location
    Surrey BC, Canada
    Posts
    309
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    $destination     'somebody@example.com';
    $subject         "Subject";

    $headers          'MIME-Version: 1.0' "\r\n";
    $headers         .= 'Content-type: text/html; charset=iso-8859-1' "\r\n";
    $headers         .= 'To: The Receiver <recipient@some.net>' "\r\n";
    $headers         .= "From: The Sender <sender@some.net>" "\r\n";

    $message        "<html><body><p>Your <i>message</i> here.</p></body></html>";

    if(
    mail($destination$subject$message$headers))
    {
    echo 
    "Email Sent: " $message;
    }
    else
    {
    echo 
    "Server messed up.";

    Try this. It works on my setup.

  7. #7
    SitePoint Addict Zarin Denatrose's Avatar
    Join Date
    Jan 2009
    Location
    Surrey BC, Canada
    Posts
    309
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also, has it occurred to you that you have no bold tags in your html?

  8. #8
    SitePoint Zealot asrasrasr's Avatar
    Join Date
    Apr 2009
    Posts
    107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    return me echo "Server messed up."

  9. #9
    SitePoint Addict Zarin Denatrose's Avatar
    Join Date
    Jan 2009
    Location
    Surrey BC, Canada
    Posts
    309
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Then the function is failing. Try removing the "To:" header.

  10. #10
    SitePoint Zealot Kayarc's Avatar
    Join Date
    Sep 2009
    Posts
    127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by asrasrasr View Post
    return me echo "Server messed up."
    The PHP mail function will only work if the server is setup properly as far as I understand it. If you continue to have issues you may have luck asking in the appropriate server forum.

    http://www.php.net/manual/en/function.mail.php for more information
    Phoenix Arizona Web Design | info *at* kayarc.com | 602.633.2676

  11. #11
    SitePoint Zealot asrasrasr's Avatar
    Join Date
    Apr 2009
    Posts
    107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i have temove to but same return.


Bookmarks

Posting Permissions

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