• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Zend mail or Swift mail?

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    Zend mail or Swift mail?

    I'm looking for a simpler way for some PHP to send emails. Currently using mail() but it's cumbersome, or perhaps I should say, prone to error. My error!

    Anyone have any experience with these libraries? Any views?

    #2
    What problems are you having with mail? Seems pretty straightforward if the host mailer is working ok. If it is actually host mail that isn't working too well you can use Google mail instead, search for phpgmailer. Just copy couple of PHP files and set ID and password. The mailing syntax is a bit simpler than mail eg:

    require_once('class.phpgmailer.php');
    $mail = new PHPGMailer();
    $mail->Username = '[email protected]';
    $mail->Password = 'pigsfeet10';

    $mail->From = $emailreply;
    $mail->FromName = $coname;
    $mail->Subject = "Your order to $coname";
    $mail->Body = $message;
    $mail->ClearAddresses();
    $mail->AddAddress($email);
    $mail->ConfirmReadingTo = "";
    $stat = $mail->Send();
    bloggoth

    If everything isn't black and white, I say, 'Why the hell not?'
    John Wayne (My guru, not to be confused with my beloved prophet Jeremy Clarkson)

    Comment


      #3
      Originally posted by xoggoth View Post
      What problems are you having with mail?
      OK, well one issue is that I *seem* to have to set the text/html and text/plain sections to have the same content. If I don't, then a spam assassin somewhere along the wire gives my email a high spam rating and mails don't get delivered. Keeping these two sections in sync seems to be an issue. One small change to one requires the same change in the other.

      I was hoping to find something where I could just set the mail body (HTML) and fire it off and not have to worry about a plain text version, or assume that the plain text part will be automatically set up correctly.

      Swift and Zend seem to offer a simpler way of doing things. Swift looks like it might give me more flexibility, whereas Zend looks like a potentially simpler interface.

      The gmail thing looks interesting, thanks!

      Comment


        #4
        Originally posted by Platypus View Post
        OK, well one issue is that I *seem* to have to set the text/html and text/plain sections to have the same content. If I don't, then a spam assassin somewhere along the wire gives my email a high spam rating and mails don't get delivered.
        This is hard to believe. Post the offending spamassasin "X-Spam-***" headers here.

        Edit: is it more likey that the spam rating comes from your ip address/host? This is quite normal if your web app spits mails without any sanity checks.
        Last edited by petergriffin; 20 March 2012, 21:07.
        <Insert idea here> will never be adopted because the politicians are in the pockets of the banks!

        Comment


          #5
          Here the the headers:


          Code:
          X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on
          	mail1312.opentransfer.com
          X-Spam-Level: *******
          X-Spam-Status: Yes, score=7.6 required=5.0 tests=HTML_MESSAGE,
          	HTML_MIME_NO_HTML_TAG,MIME_HEADER_CTYPE_ONLY,MIME_HTML_ONLY,MPART_ALT_DIFF,
          	RDNS_NONE autolearn=disabled version=3.2.5
          X-Spam-Report: 
          	*  0.0 HTML_MESSAGE BODY: HTML included in message
          	*  2.5 MPART_ALT_DIFF BODY: HTML and text parts are different
          	*  2.3 MIME_HTML_ONLY BODY: Message only has text/html MIME parts
          	*  1.0 MIME_HEADER_CTYPE_ONLY 'Content-Type' found without required MIME
          	*      headers
          	*  1.7 HTML_MIME_NO_HTML_TAG HTML-only message, but there is no HTML tag
          	*  0.1 RDNS_NONE Delivered to trusted network by a host with no rDNS
          The reference to mail1312.opentransfer.com is my web server's SMTP server as far as I can tell.

          I'm more than willing to accept that I copied an example from t'internet and messed it up. Here is the message content:

          Code:
          Content-Type: multipart/mixed; boundary="PHP-mixed-5475f42c3735d46e07176eff1b16f5be"
          
          --PHP-mixed-5475f42c3735d46e07176eff1b16f5be
          Content-Type: multipart/alternative; boundary="PHP-alt-5475f42c3735d46e07176eff1b16f5be";
          
          Content-Type: text/plain; charset="iso-8859-1"
          Content-Transfer-Encoding: 7bit
          
          Form received - See Attachment.
          
          --PHP-alt-5475f42c3735d46e07176eff1b16f5be
          Content-Type: text/html; charset="iso-8859-1"
          Content-Transfer-Encoding: 7bit
          
          <p>Form received - See Attachment.</p>
          
          --PHP-alt-5475f42c3735d46e07176eff1b16f5be--

          Thoughts?

          Comment


            #6
            Originally posted by petergriffin View Post
            This is hard to believe. Post the offending spamassasin "X-Spam-***" headers here.

            Edit: is it more likey that the spam rating comes from your ip address/host? This is quite normal if your web app spits mails without any sanity checks.
            I don't know what antispam thingy my ISP uses but I saw the text and html differing rule flagged just the other day. However, there were half a dozen other spam rules that had been triggered by that email. Maybe the different text and html rule doesn't carry a high enough score to trigger things?

            It surprised me too. I'd never seen that rule before. Is it a new thing?
            Last edited by Sysman; 21 March 2012, 13:02.
            Behold the warranty -- the bold print giveth and the fine print taketh away.

            Comment


              #7
              Originally posted by Sysman View Post
              Maybe the different text and html sule doesn't carry a high enough score to trigger things?
              As you can see, it scores 2.5 for me, which is high (since 5 is the threshold).

              Comment


                #8
                Code:
                MIME_HTML_ONLY BODY: Message only has text/html MIME parts
                Yes, the web script is not well designed. Can you not just send a text-only email? Why do you need html code in your message?
                <Insert idea here> will never be adopted because the politicians are in the pockets of the banks!

                Comment


                  #9
                  Originally posted by Platypus View Post
                  Thoughts?
                  Do the mails need to contain pretty pictures or will plain text do, as PG suggests?

                  What is the email audience? Technical or Joe Public?

                  Being a techie myself, I always opt to receive emails in plain text if I'm given the choice. However all too often that means you have to visit the sender's website to see the full content and Joe Public might miss it.
                  Behold the warranty -- the bold print giveth and the fine print taketh away.

                  Comment


                    #10
                    Originally posted by petergriffin View Post
                    Can you not just send a text-only email? Why do you need html code in your message?
                    Originally posted by Sysman View Post
                    Do the mails need to contain pretty pictures or will plain text do, as PG suggests?
                    Yes and no. In the example shown, plain text will do, plus an attachment.

                    But I'm working on another web site for someone else, that will need to be all pretty with in-line pictures and unsubscribe links etc etc.

                    Comment

                    Working...
                    X