Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid


by Anonymous Monk
on Feb 11, 2003 at 15:12 UTC ( #234413=perlquestion: print w/replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am having trouble sending mutipart/alternative messages through perl using the code below. Are there rrors in this code? Am I missing something? Thanks in advance.
print MAIL "To: $config->{email_to}\n"; print MAIL "From: $config->{email_from}\n"; print MAIL "Subject: $config->{email_subject}\n"; print MAIL "Content-Type: multipart/alternative; boundary=zzz\n\n"; print MAIL qq^ --zzz Content-Type: text/plain $config->{email_comment} Read the full story at:\n$config->{url} --zzz Content-Type: text/html $UrlHtmlData --zzz--

Replies are listed 'Best First'.
Re: Multipart/Alternative
by Abigail-II (Bishop) on Feb 11, 2003 at 15:37 UTC
    Assuming there's a closing ^ somewhere, I don't see any Perl errors in the code. After all, all you have are print statements.

    I'd prefer to use a single here doc, but that's another issue.

    Now, whether you are using the correct MIME format, I don't know. I presume that if you aren't using a module for it, you know the MIME format better than I do.

    What has happened to the times when email was plain text, and nothing more than plain text?

Re: Multipart/Alternative
by extremely (Priest) on Feb 11, 2003 at 15:50 UTC
    You'd be a lot happier in life if you'd just grab the MailTools package. (try MIME::Entity especially.)

    $you = new YOU;
    honk() if $you->love(perl)

Re: Multipart/Alternative
by extremely (Priest) on Feb 11, 2003 at 16:03 UTC
    Oh, and to actually answer your non-perl question :), I think you need to doublequote the boundary string in the header. And I'm darn certain that "===" isn't a good idea for a string.

    If I were you, I'd make it a _lot_ uglier.

    $you = new YOU;
    honk() if $you->love(perl)

Re: Multipart/Alternative
by Jenda (Abbot) on Feb 11, 2003 at 20:48 UTC
    use Mail::Sender;

    I'm not gonna copy the example from the module into here. The link above will take you directly to the code.

    HTH, Jenda

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://234413]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2018-03-20 14:53 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (254 votes). Check out past polls.