Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Sending a MIME::Entity email on OS X

by mboudreau (Acolyte)
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?

Replies are listed 'Best First'.
Re: Sending a MIME::Entity email on OS X
by Anonymous Monk on May 20, 2009 at 03:38 UTC


      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");
      open(MAIL, "|/usr/sbin/sendmail -t")
      results in the message being sent.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://765027]
Approved by Perlbotics
[marto]: William Gibson was right
[moritz]: a classical problem with machine learning
[1nickt]: moritz isn;t the difference today that the machine learning algos are in charge of most stuffs?
[moritz]: depends on what you mean by "most stuff"
[1nickt]: I am sure I don't know about most of the stuff that is no longer controlled by humans. I do know that it's past the point of determining consumer pricing and into things that can kill me with blunt force!
[holli]: but is this really a problem 1nickt? Nobody knows how your human taxi drivers brain works either

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2017-11-21 13:06 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (301 votes). Check out past polls.