PHP create HTML email inserts '!'s

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • geek7

    PHP create HTML email inserts '!'s

    OK,

    I'm trying to create an email and when it sends the email, it mostly
    works except that there are '!' inserted at some spots. Checking the
    html source of the email, looks like they are placed at the end of
    long lines. I'm assuming there is some issue with the encoding, but
    searching through groups, nothing I've tried has worked. Can someone
    let me know if I should be doing something differently with my headers
    for an html email? I'll change emails to null@null.com. Thanks!

    $headers = "X-Mailer: PHP " . phpversion() . "\r\n";
    $headers .= "From: null@null.com\r\n";
    $headers .= "Reply-To: null@null.com\r\n";
    $headers .= "Content-Type: text/html;\r\n";
    $headers .= "charset=\" iso-8859-1\"\r\n";
    $headers .= "Content-Transfer-Encoding: 7bit\r\n";

  • Manuel Lemos

    #2
    Re: PHP create HTML email inserts '!'s

    Hello,

    on 02/07/2007 05:03 PM geek7 said the following:
    OK,
    >
    I'm trying to create an email and when it sends the email, it mostly
    works except that there are '!' inserted at some spots. Checking the
    html source of the email, looks like they are placed at the end of
    long lines. I'm assuming there is some issue with the encoding, but
    searching through groups, nothing I've tried has worked. Can someone
    let me know if I should be doing something differently with my headers
    for an html email? I'll change emails to null@null.com. Thanks!
    >
    $headers = "X-Mailer: PHP " . phpversion() . "\r\n";
    $headers .= "From: null@null.com\r\n";
    $headers .= "Reply-To: null@null.com\r\n";
    $headers .= "Content-Type: text/html;\r\n";
    $headers .= "charset=\" iso-8859-1\"\r\n";
    $headers .= "Content-Transfer-Encoding: 7bit\r\n";
    I think you need to encode your message with MIME quoted-printable.

    If you do not know how to compose MIME quoted-printable messages, you
    may want to try this MIME message class:



    It is also better to include an alternative plain text part using
    multipart/alternative MIME parts. This is not related to you problem.
    Just a comment after noticing you used Content-Type set to text/html .
    The class above can also help solving that problem.



    --

    Regards,
    Manuel Lemos

    Metastorage - Data object relational mapping layer generator


    PHP Classes - Free ready to use OOP components written in PHP
    Free PHP Classes and Objects 2026 Versions with PHP Example Scripts, PHP Tutorials, Download PHP Scripts, PHP articles, Remote PHP Jobs, Hire PHP Developers, PHP Book Reviews, PHP Language OOP Materials

    Comment

    • Toby A Inkster

      #3
      Re: PHP create HTML email inserts '!'s

      geek7 wrote:
      $headers .= "Content-Type: text/html;\r\n";
      $headers .= "charset=\" iso-8859-1\"\r\n";
      This is broken.

      Should be either:

      $headers .= "Content-Type: text/html; ";
      $headers .= "charset=\" iso-8859-1\"\r\n";

      or:

      $headers .= "Content-Type: text/html;\r\n";
      $headers .= "\tcharset=\"is o-8859-1\"\r\n";

      --
      Toby A Inkster BSc (Hons) ARCS
      Contact Me ~ http://tobyinkster.co.uk/contact
      Geek of ~ HTML/CSS/Javascript/SQL/Perl/PHP/Python*/Apache/Linux

      * = I'm getting there!

      Comment

      • geek7

        #4
        Re: PHP create HTML email inserts '!'s

        I have been struggling with this for a while now.. I did change the
        errors like Toby said, and it did fix another problem I had, but I
        still cannot figure out how to properly use the mimemessage class.
        Does anyone have an example of this class encoding with quoted
        printable? I'm sure the answer is in the documentation staring me in
        the face, but I'm fairly new to PHP and can't get it. Thanks ahead of
        time!

        Derek

        Comment

        • Satya

          #5
          Re: PHP create HTML email inserts '!'s

          On Mar 1, 2:09 pm, "geek7" <dpoe...@gmail. comwrote:
          I have been struggling with this for a while now.. I did change the
          errors like Toby said, and it did fix another problem I had, but I
          still cannot figure out how to properly use the mimemessage class.
          Does anyone have an example of this class encoding with quoted
          printable? I'm sure the answer is in the documentation staring me in
          the face, but I'm fairly new to PHP and can't get it. Thanks ahead of
          time!
          >
          Derek
          I will suggest using this class and enjoy instead of wasting time on
          email.
          Here you can send html and text mail, both at a time also. client who
          do not understand
          html will display text msg. Work for attachment, and more.

          phpmailer.sourc eforge.net/

          Comment

          • Manuel Lemos

            #6
            Re: PHP create HTML email inserts '!'s

            Hello,

            on 03/01/2007 04:09 PM geek7 said the following:
            I have been struggling with this for a while now.. I did change the
            errors like Toby said, and it did fix another problem I had, but I
            still cannot figure out how to properly use the mimemessage class.
            Does anyone have an example of this class encoding with quoted
            printable? I'm sure the answer is in the documentation staring me in
            the face, but I'm fairly new to PHP and can't get it. Thanks ahead of
            time!
            Take a look at the test_simple_htm l_mail_message. php script that uses
            the MIME message class to compose and send quoted-printable HTML
            messages that avoid the ! problem.




            --

            Regards,
            Manuel Lemos

            Metastorage - Data object relational mapping layer generator


            PHP Classes - Free ready to use OOP components written in PHP
            Free PHP Classes and Objects 2026 Versions with PHP Example Scripts, PHP Tutorials, Download PHP Scripts, PHP articles, Remote PHP Jobs, Hire PHP Developers, PHP Book Reviews, PHP Language OOP Materials

            Comment

            • geek7

              #7
              Re: PHP create HTML email inserts '!'s

              On Mar 4, 1:17 am, Manuel Lemos <mle...@acm.org wrote:
              Hello,
              >
              on 03/01/2007 04:09 PM geek7 said the following:
              >
              I have been struggling with this for a while now.. I did change the
              errors like Toby said, and it did fix another problem I had, but I
              still cannot figure out how to properly use the mimemessage class.
              Does anyone have an example of this class encoding with quoted
              printable? I'm sure the answer is in the documentation staring me in
              the face, but I'm fairly new toPHPand can't get it. Thanks ahead of
              time!
              >
              Take a look at the test_simple_htm l_mail_message. phpscript that uses
              the MIME message class to compose and send quoted-printableHTML
              messages that avoid the ! problem.
              >

              >
              --
              >
              Regards,
              Manuel Lemos
              >
              Metastorage - Data object relational mapping layer generatorhttp://www.metastorage .net/
              >
              PHPClasses - Free ready to use OOP components written inPHPhttp://www.phpclasses. org/

              Manuel,

              This helps a ton! I got the email to format correctly, but I have just
              one more issue if you could help I would greatly appreciate it. I am
              trying to add multiple addresses to the email I wrote. Looking in the
              documentation, it says I can use:

              $message_object->SetMultipleEnc odedEmailHeader ('Bcc', array(
              'peter@gabriel. org' ='Peter Gabriel',
              'paul@simon.net ' ='Paul Simon',
              'mary@chain.com ' ='Mary Chain'
              );

              but When I do this, no one gets the email..same if I change 'Bcc' to
              'To'. Do I need to change all my SetEncodedEmail Header functions to
              SetMultipleEnco dedEmailHeader? Or is there an easy way to do multiple
              addresses...(ot her than putting one in the to, cc, and bcc...) thanks!

              Comment

              • Manuel Lemos

                #8
                Re: PHP create HTML email inserts '!'s

                Hello,

                on 03/07/2007 01:20 PM geek7 said the following:
                >>I have been struggling with this for a while now.. I did change the
                >>errors like Toby said, and it did fix another problem I had, but I
                >>still cannot figure out how to properly use the mimemessage class.
                >>Does anyone have an example of this class encoding with quoted
                >>printable? I'm sure the answer is in the documentation staring me in
                >>the face, but I'm fairly new toPHPand can't get it. Thanks ahead of
                >>time!
                >Take a look at the test_simple_htm l_mail_message. phpscript that uses
                >the MIME message class to compose and send quoted-printableHTML
                >messages that avoid the ! problem.
                >>
                >http://www.phpclasses.org/mimemessage
                >
                This helps a ton! I got the email to format correctly, but I have just
                one more issue if you could help I would greatly appreciate it. I am
                trying to add multiple addresses to the email I wrote. Looking in the
                documentation, it says I can use:
                >
                $message_object->SetMultipleEnc odedEmailHeader ('Bcc', array(
                'peter@gabriel. org' ='Peter Gabriel',
                'paul@simon.net ' ='Paul Simon',
                'mary@chain.com ' ='Mary Chain'
                );
                >
                but When I do this, no one gets the email..same if I change 'Bcc' to
                'To'. Do I need to change all my SetEncodedEmail Header functions to
                SetMultipleEnco dedEmailHeader? Or is there an easy way to do multiple
                addresses...(ot her than putting one in the to, cc, and bcc...) thanks!
                Not getting messages when you set all to Bcc is normal. Many mail
                filters do not like that. As for To: it should work . If it doesn't,
                there may be some other problem.

                You can also try set the To header with the SetHeader function, only
                with e-mail addresses separated with commas , .

                --

                Regards,
                Manuel Lemos

                Metastorage - Data object relational mapping layer generator


                PHP Classes - Free ready to use OOP components written in PHP
                Free PHP Classes and Objects 2026 Versions with PHP Example Scripts, PHP Tutorials, Download PHP Scripts, PHP articles, Remote PHP Jobs, Hire PHP Developers, PHP Book Reviews, PHP Language OOP Materials

                Comment

                Working...