unix - Postfix on Snow Leopard unable to send MIME emails, including header contents in message body

12
2013-08
  • devvy

    I configured postfix on snow leopard by adding the following line to /etc/hostconfig:

    MAILSERVER=-YES-
    

    I then configured postfix to relay through my ISP's SMTP server. I added the following two lines in their respective places within /etc/postfix/main.cf:

    myhostname = 1and1.com
    relayhost = shawmail.vc.shawcable.net
    

    I then have a simple PHP mail function wrapper as follows:

    send_email("[email protected]", "[email protected]", "Test Email", "<p>This is a simple HTML email</p>");
    echo "Done";
    
    function send_email($from,$to,$subject,$message){
     $header="From: <".$from.">
    ";
     $header.= 'MIME-Version: 1.0' . "
    ";
     $header.= 'Content-type: text/html; charset=iso-8859-1' . "
    "; 
     $send_mail=mail($to,$subject,$message,$header);
     if(!$send_mail){ echo "ERROR"; }
    }
    

    With this, I am receiving an e-mail that appears to be improperly formatted. The message header is showing up in the body of the e-mail. The raw message content is as follows:

    Return-Path: <[email protected]>
    Delivery-Date: Tue, 27 Apr 2010 18:12:48 -0400
    Received: from idcmail-mo2no.shaw.ca (idcmail-mo2no.shaw.ca [64.59.134.9])
     by mx.perfora.net (node=mxus2) with ESMTP (Nemesis)
     id 0M4XlU-1NCtC81GVY-00z5UN for [email protected]; Tue, 27 Apr 2010 18:12:48 -0400
    Message-Id: <7vpiof$[email protected]>
    Received: from pd6ml3no-ssvc.prod.shaw.ca ([10.0.153.149])
      by pd6mo1no-svcs.prod.shaw.ca with ESMTP; 27 Apr 2010 16:12:47 -0600
    X-Cloudmark-SP-Filtered: true
    X-Cloudmark-SP-Result: v=1.0 c=1 a=VphdPIyG4kEA:10 a=hATtCjKilyj9ZF5m5A62ag==:17 a=mC_jT1gcAAAA:8
     a=QLyc3QejAAAA:8 a=DGW4GvdtALggLTu6w9AA:9 a=KbDtEDGyCi7QHcNhDYYwsF92SU8A:4
     a=uch7kV7NfGgA:10 a=5ZEL1eDBWGAA:10
    Received: from unknown (HELO 1and1.com) ([24.84.196.104])
      by pd6ml3no-dmz.prod.shaw.ca with ESMTP; 27 Apr 2010 16:12:48 -0600
    Received: by 1and1.com (Postfix, from userid 70)
     id BB08D14ECFC; Tue, 27 Apr 2010 15:12:47 -0700 (PDT)
    To: [email protected]
    Subject: Test Email
    X-PHP-Originating-Script: 501:test.php
    Date: Tue, 27 Apr 2010 18:12:48 -0400
    X-UI-Junk: AutoMaybeJunk +30 (SPA);
      V01:LYI2BGRt:7TwGx5jxe8cylj5nOTae9JQXYqoWvG2w4ZSfwYCXmHCH/5vVNCE
      fRD7wNNM86txwLDTO522ZNxyNHhvJUK9d2buMQuAUCMoea2jJHaDdtRgkGxNSkO2
      v6svm0LsZikLMqRErHtBCYEWIgxp2bl0W3oA3nIbtfp3li0kta27g/ZjoXcgz5Sw
      B8lEqWBqKWMSta1mCM+XD/RbWVsjr+LqTKg==
    Envelope-To: [email protected]
    
    From: <[email protected]>
    MIME-Version: 1.0
    Content-type: text/html; charset=iso-8859-1
    Message-Id: <[email protected]>
    Date: Tue, 27 Apr 2010 15:12:47 -0700 (PDT)
    
    
    <p>This is a simple HTML email</p>
    

    And here are the contents of my /var/log/mail.log file after sending the email:

    Apr 27 15:29:01 User-iMac postfix/qmgr[705]: 74B1514EDDF: removed
    Apr 27 15:29:30 User-iMac postfix/pickup[704]: 25FBC14EDF0: uid=70 from=<_www>
    Apr 27 15:29:30 User-iMac postfix/master[758]: fatal: open lock file pid/master.pid: unable to set exclusive lock: Resource temporarily unavailable
    Apr 27 15:29:30 User-iMac postfix/cleanup[745]: 25FBC14EDF0: message-id=<[email protected]>
    Apr 27 15:29:30 User-iMac postfix/qmgr[705]: 25FBC14EDF0: from=<[email protected]>, size=423, nrcpt=1 (queue active)
    Apr 27 15:29:30 User-iMac postfix/smtp[747]: 25FBC14EDF0: to=<[email protected]>, relay=shawmail.vc.shawcable.net[64.59.128.135]:25, delay=0.21, delays=0.01/0/0.1/0.1, dsn=2.0.0, status=sent (250 ok:  Message 25784419 accepted)
    Apr 27 15:29:30 User-iMac postfix/qmgr[705]: 25FBC14EDF0: removed
    

    Two other people in the office have followed the exact same process and are running the exact same script, version of snow leopard, php, etc. and everything is working fine for them. I've even copied their config files to my machine, restarted postfix, restarted apache, all to no avail.

    Does anyone know what steps I could take to resolve the issue? This is boggling my mind...

    Thanks

  • Answers
  • devvy

    Yes, as taspeotis mentioned, I fixed it by removing the line "mail.add_x_header = On" from my php.ini

    I'll see if I can mark this as the answer.


  • Related Question

    osx - What is Rosetta and why doesn't Snow Leopard include it by default?
  • Chris W. Rea

    Since I repaved my MacBook with Snow Leopard this morning, I was about to reinstall one of the applications I use, Adobe Flex Builder 3. When I opened FB3's installer, the following was displayed:

    To open __, you need to install Rosetta.  Would you like to install it now?

    (Dialog says: "To open FB3_Mac_Installer, you need to install Rosetta. Would you like to install it now?")

    Questions:

    1. What exactly is Rosetta? (I have an idea, but your expert answer is probably better than my understanding.)

    2. Why don't I already have Rosetta included with my fresh from-scratch Snow Leopard install? It looks like Rosetta comes from Apple. Why would Apple decide to not include it? Would this have been an optional install from my Snow Leopard DVD, or is it only available online from Apple?

    3. Why would a relatively recent installer such as Adobe Flex Builder 3 require Rosetta? I've installed many other packages already and hadn't seen this message, until now. Is Adobe doing something silly?

    4. Is there any performance or other impact or concern with having Rosetta installed?


  • Related Answers
  • knweiss

    What exactly is Rosetta? (I have an idea, but your expert answer is probably better than my understanding.)

    Rosetta is a piece of software through which PowerPC code can be run on an Intel Mac.

    Why don't I already have Rosetta included with my new Snow Leopard install? Why would Apple decide to not include it? Would this have been an optional install from my Snow Leopard DVD, or is it only available online from Apple?

    Snow Leopard is Intel-only. Apple essentially wants the few remaining developers who still have PowerPC-only software to recompile it for Intel. Rosetta is an optional install which is available on the Snow Leopard DVD.

    Why would a relatively recent installer such as Adobe Flex Builder 3 require Rosetta? Is Adobe doing something silly?

    Adobe's Mac range is possibly the worst-made set of applications that anybody actually uses. See Adobe UI Gripes for more Adobe hating.

    Is there any performance or other impact or concern with having Rosetta installed?

    Only when you're running PowerPC code. Simply having it installed will not decrease performance. There is little reason for you not to install it; it's a small package that allows some software to be run slowly that otherwise couldn't run at all.

    I've made this CW so please edit this if you have something to add.

  • Diago

    According to the Adobe website only the CS4 product range has been certified as Snow Leopard compatible and the compatibility list available here shows that Flex 3 is still untested.

    Rosetta is the technology that allows PowerPC applications to run on Intel Macs. From everything I have seen thus far this has been removed from Snow Leopard by default, and based on your screenshot will install when required. Potentially this will be removed in the next OSX version.

  • contact us

    Rosetta is a lightweight dynamic translator for Mac OS X distributed by Apple. It enables applications compiled for the PowerPC family of processors to run on Apple systems that use Intel processors. Rosetta is based on Transitive Corporation's QuickTransit technology, and it is a key part of Apple's strategy for the transition of their Macintosh line from PowerPC to Intel processors as it enables pre-existing Mac OS X software to run on the new platform without modification.

    The name is likely a reference to the Rosetta Stone, whose discovery made it possible to comprehend and translate Egyptian hieroglyphs.

    Source: Wikipedia