Hello Perl Monks

I have multiple files I want to send to multiple emails. One file goes to one email recipient. I have StrawberryPerl 5.20.1.1 (64bit) on Windows 7 (64 bit). I have Mail::Sender installed. I copied the following code from, actually, I've looked at so many sites I forget where I copied it from. SMTP, To and From are real and will be used for my testing purposes.

#!/usr/local/bin/perl -w use Mail::Sender; $sender = {}; if ($sender->MailMsg({ smtp => 'ECMAIL7.internal.lacoe.edu', from => 'mansell_steven@lacoe.edu', to =>'sgmansell@gmail.com', subject => 'this is a test', msg => "Hi Steve.\nHow are you?" }) < 0) { print "if must be less than 0\n"; die "$Mail::Sender::Error\n"; } print "Mail sent OK."

I get this error

Can't call method "MailMsg" on unblessed reference at email_code.pl line 5.

I am not familiar with methods so I'm not sure what to do at this point.

1. Is there a way to send email without using methods? or do I need to learn methods?

2. Is there a way to test if I'm able to send an email through the Exchange server?

Thanks,

Steve


In reply to email through Exchange server using StrawberryPerl by sgmansell

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.