Problems with mail()

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default Problems with mail()

    Im having a formatting issue with mail().

    My simple script looks like:

    $key = [email]blah@blah.com[/email];
    $subject = "My membership";
    $message_to_send = "<strong>Hello".$key."</strong>";

    mail($key, $subject, $message_to_send, "From: [email]blah@blah.com[/email]");

    When it comes to my email client it appears as:

    <strong>Hello [email]blah@blah.com[/email]</strong>

    Instead of:

    Hello [email]blah@blah.com[/email]

    I have also tried adding <html> and <body> tags but that doesn't seem to do anything.
    I get other HMTL messages from amazon and such but it would appear that one generated from mail() is sending only raw text.
    How do I get it to format HTML based message?


    Ryan Ramsey Guest

  2. Similar Questions and Discussions

    1. CFMX 6 Mail Problems
      We have been experiencing a number of issues related to CFMX 6's mail handling. Several applications have experienced issues with mail messages...
    2. e-Mail Problems
      A .pdf document was created using InDesign CS. When the .pdf document was e-mailed to two individuals one was able to open and print the document but...
    3. problems with Mail::Mailer
      I need to fix a script that sends out emails from my site using Mail::Mailer and send using the smtp method (which involkes Net::SMTP). The sender...
    4. PHP Mail Problems
      BillyJoe wrote: I believe the From: needs a real existing email adress.
    5. Two problems...e-mail sending and DSN
      It's been a while since I posted here, but here goes. Our server is a Windows 2000 Server with Service Pack 3, IIS 5 with Lockdown Wizard...
  3. #2

    Default Re: Problems with mail()


    "Ryan Ramsey" <ryanramsey@yahoo.com> schreef in bericht
    news:bhZOa.875$5o5.577540@news1.news.adelphia.net. ..
    > Im having a formatting issue with mail().
    >
    >My simple script looks like:
    >
    .....
    >When it comes to my email client it appears as:
    > <strong>Hello [email]blah@blah.com[/email]</strong>
    >
    >Instead of:
    > Hello [email]blah@blah.com[/email]
    First of all: DO NOT send HTML mail to newsgroups!!! In your e-mail client
    there's a setting which allows you to select plain text a-mails for
    newsgroups and HTML for others.

    To answer your question: Use the the fourth argument of the mail() function
    to send a content type header with text/html as the value:

    mail($key, $subject, $message_to_send, "From: [email]blah@blah.com[/email]\nContent-Type:
    text/html");


    JW



    Janwillem Borleffs Guest

  4. #3

    Default Re: Problems with mail()

    Ok here is another question...

    It would seem that the mail() is injecting a "! " in the text of
    $message_to_sender:

    So text that should read:

    There once were three bears that lived in a big black house.

    Would look like:

    There once were three bears that lived in a big blac! k house

    Does this look familiar? Does mail() have an issue with the size of the
    message being passed? If I increase the size of the text, the "! " will move
    accordingly (im guessing at char 255).


    "Esteban Fernández" <eft0@gmx.nospam.net> wrote in message
    news:3f0c7ed3@omega.ifxnw.cl...
    > Easy, just replace you mail line code, for thi one.
    >
    > mail($key, $subject, $message_to_send, "Content-Type: text/html\nFrom:
    > [email]blah@blah.com[/email]");
    >
    > Regards.
    > EF.
    >
    >
    > "Ryan Ramsey" <ryanramsey@yahoo.com> escribió en el mensaje
    > news:bhZOa.875$5o5.577540@news1.news.adelphia.net. ..
    > Im having a formatting issue with mail().
    >
    > My simple script looks like:
    >
    > $key = [email]blah@blah.com[/email];
    > $subject = "My membership";
    > $message_to_send = "<strong>Hello".$key."</strong>";
    >
    > mail($key, $subject, $message_to_send, "From: [email]blah@blah.com[/email]");
    >
    > When it comes to my email client it appears as:
    >
    > <strong>Hello [email]blah@blah.com[/email]</strong>
    >
    > Instead of:
    >
    > Hello [email]blah@blah.com[/email]
    >
    > I have also tried adding <html> and <body> tags but that doesn't seem to
    do
    > anything.
    > I get other HMTL messages from amazon and such but it would appear that
    one
    > generated from mail() is sending only raw text.
    > How do I get it to format HTML based message?
    >
    >
    >

    Ryan Ramsey Guest

  5. #4

    Default Re: Problems with mail()


    "Ryan Ramsey" <ryanramsey@yahoo.com> wrote in message
    news:xL0Pa.1079$5o5.639092@news1.news.adelphia.net ...
    > Ok here is another question...
    >
    > It would seem that the mail() is injecting a "! " in the text of
    > $message_to_sender:
    >
    > So text that should read:
    >
    > There once were three bears that lived in a big black house.
    >
    > Would look like:
    >
    > There once were three bears that lived in a big blac! k house
    >
    > Does this look familiar? Does mail() have an issue with the size of the
    > message being passed? If I increase the size of the text, the "! " will
    move
    > accordingly (im guessing at char 255).
    >
    A simple "Content-Type: text/html;charset=ISO-8859-1\n" should fix this.

    JW



    Janwillem Borleffs Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139