Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Trying to send a nicely formatted email -> GMail

by hippo (Bishop)
on Apr 25, 2018 at 15:50 UTC ( [id://1213538]=note: print w/replies, xml ) Need Help??


in reply to Trying to send a nicely formatted email -> GMail

my $email = Email::MIME->create( header_str => [ From => [ "cdatwitter\@grumble.edu" ], To => [ "gbecker\@grumble.edu" ], Subject => [ "Yes this is for Twitter" ], ], parts => [ @parts ], );

You are using arrayrefs for everything - that isn't how the synopsis shows you to use the header_str field. Try:

my $email = Email::MIME->create( header_str => [ From => 'cdatwitter@grumble.edu', To => 'gbecker@grumble.edu', Subject => 'Yes this is for Twitter', ], parts => [ @parts ], );

Replies are listed 'Best First'.
Re^2: Trying to send a nicely formatted email -> GMail
by thanos1983 (Parson) on Apr 25, 2018 at 16:17 UTC

    Just a minor note here :)

    The To       => 'gbecker@grumble.edu', should be To       => [ 'gbecker@grumble.edu' ], as it can be multiple recipients.

    For example from Email::MIME::SYNOPSIS: To => [ 'user1@host.com', 'Name <user2@host.com>' ],.

    BR / Thanos

    Seeking for Perl wisdom...on the process of learning...not there...yet!

      Minor counter-note: the synopsis shows both arrayref and scalar:

      header_str => [ From => 'casey@geeknest.com', To => [ 'user1@host.com', 'Name <user2@host.com>' ], Cc => Email::Address::XS->new("Display Name \N{U+1F600}", 'use +r@example.com'), ], ... header_str => [ From => 'my@address', To => 'your@address', ],
      so either are presumably allowed. The important thing is that the From and the Subject are never shown as arrayref (and it doesn't make sense for more than one sender or more than one subject line)

Re^2: Trying to send a nicely formatted email -> GMail
by chexmix (Hermit) on Apr 25, 2018 at 16:19 UTC

    Progress, thanks. I'm still getting a blank email, but the subject line is correct.

    Not sure what I need to do to get that text file inserted, but will keep trying.

      Add close MAILTEXT; at line 63

      poj

        Yes! closing MAILTEXT. Can't believe I didn't do that, but I haven't been programming much lately. :/

        The text now appears in the email but unfortunately GMail is still mangling my nice set-up columns, so I have to keep poking at this one.

        I appreciate the help on it

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1213538]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-19 23:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found