Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

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
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2017-03-29 14:23 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (351 votes). Check out past polls.