Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Sending a MIME::Entity email on OS X

by mboudreau (Novice)
on May 19, 2009 at 20:42 UTC ( #765027=perlquestion: print w/ replies, xml ) Need Help??
mboudreau has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,

I'm developing an application on OS X (10.5.7) using Apache (2.2.11), mod_perl (2.0.2) and Mason. I'm using MIME::Entity to create an email, like this (error checking omitted for clarity):

use MIME::Entity; my $entity = MIME::Entity->build ( To => $to, From => $from, Cc => $cc, Subject => $subject, Data => "$body\n" ); open (MAIL, "|/usr/bin/mail"); $entity->print(\*MAIL); close(MAIL);

The problem is that nothing seems to happen. I've used similar code on a Solaris system, where I invoked mail with the "-t" option. On OS X the "-t" option gives me a "broken pipe" error message on the close command. Without that option, no error messages appear, but no mail appears to be sent.

I have looked at the manpage for the OS X mail command and didn't find any help, but it's possible I missed something.

Has anyone been down this road before? Can you point me in the right direction?

Comment on Sending a MIME::Entity email on OS X
Download Code
Re: Sending a MIME::Entity email on OS X
by Anonymous Monk on May 20, 2009 at 03:38 UTC

      Adding

      MIME::Tools->debugging(1); MIME::Tools->quiet(0);
      didn't have any effect: no error messages about the Mime tools.

      However, changing

      open(MAIL, "|/usr/bin/mail");
      to
      open(MAIL, "|/usr/sbin/sendmail -t")
      results in the message being sent.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://765027]
Approved by Perlbotics
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2015-07-03 21:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (56 votes), past polls