Hi monks,

I've been trying to send a sample email using below sample script and receiving an error,

Code:

#!/usr/bin/perl use strict; use warnings; use plmconst ':constants'; use lib "C:\\Strawberry\\perl\\lib"; use lib "C:\\Strawberry\\perl\\site\\lib"; use lib "C:\\Strawberry\\perl\\vendor\\lib\\Email"; use lib "C:\\Strawberry\\perl\\vendor\\lib"; use lib "C:\\Users\\magesh\\SF\\Personal Folders\\Material master\\Mat +erial_Master_Prod\\Test"; use lib "C:\\Strawberry\\perl\\c\\bin"; use plm_sap_material_master_constant_definitions ':constants'; # first, create your message use Email::MIME::Creator; use Email::Sender::Success; use Email::Sender::Transport::SMTP qw(); use Email::Sender::Role::CommonSending; use Email::MIME::Header::AddressList; use Email::Sender::Transport; use Email::Sender; use Email::MIME; use Throwable; use Throwable::Error; use StackTrace::Auto; use IO::All; my $message = Email::MIME->create( header_str => [ From => SENDER_EMAIL, To => 'mzkuma@abc.com', Subject => 'Happy birthday!', ], attributes => { encoding => 'quoted-printable', charset => 'ISO-8859-1', }, body_str => "Happy birthday to you!\n", ); my $mime_entity = $message->cast('Email::MIME'); # send the message use Email::Sender::Simple qw(sendmail); sendmail($mime_entity,{ from => SENDER_EMAIL, transport => Email::Sender::Transport::SMTP->new ({ host => MAIL_SERVER, port => MAIL_SERVER_PORT, }) });

Error: "Don't know how to handle Email::MIME at C:\Users\AADDAA~1\AppData\Local\Temp\11 par-616164646161646d696e\cache-59feac640e183270594e4311795b30444ad958c9\inc\lib Email/Sender/Role/CommonSending.pm line 78." Can you please help me to understand what I'm missing? Thanks a lot. BR, Magesh


In reply to How to send email using Email::MIME & Email::Sender::Simple? by Magkumar

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.