Sending emails using perl script - issue with the script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • osm3000
    New Member
    • Sep 2013
    • 1

    Sending emails using perl script - issue with the script

    Hi All,

    I'm using trying to make a script to send email using perl.

    I found this in



    I found this one, however it doesn't work.
    Code:
    ////////////////////////////////////////////
    use strict; 
       use warnings;  
     
       use Mail::Sender::Easy qw(email); 
     
        print "Content-type: text/plain\n\n";
     
     
        email({
            #from email address need to change
            'from'         => 'omar.samir3000@gmail.com',
            'to'           => 'omar.samir3000@gmail.com',
            #'cc'           => 'your_pal@ddre.ss',
            'subject'      => 'Perl is great!',
            'priority'     => 2, # 1-5 high to low
            'confirm'      => 'delivery, reading',
            'smtp'         => '192.168.2.111',
            'port'         => 25,
            #'auth'         => 'LOGIN',
            'authid'       => 'andrew@inovaventure.com',
            'authpwd'      => 'andrew2100',
            '_text'        => 'Hello *World* :)',    
            #'_html'        => 'Hello <b>World</b> <img src="cid:smile1" />',
            #'_attachments' => {
                #'smiley.gif' => {
                    #'_disptype'   => 'GIF Image',
                    #'_inline'     => 'smile1',
                    #'description' => 'Smiley',
                    #'ctype'       => 'image/gif',    
                    #'file'        => '/home/foo/images/smiley.gif',
                #},
                #'mydata.pdf' => {
                    #'description' => 'Data Sheet',  
                    #'ctype'       => 'application/pdf',
                    #'msg'         => $pdf_guts,
                #},
            #},
        }) or die "email() failed: $@";
    ////////////////////////////////////
    It shows that : email() failed: Mail::Sender::E rror: Connection not established

    Any help?!
    Last edited by Rabbit; Sep 4 '13, 08:50 PM. Reason: Please use code tags when posting code.
  • numberwhun
    Recognized Expert Moderator Specialist
    • May 2007
    • 3467

    #2
    I can only imagine that the IP address you specified is your mail server. If it is, great. I would ask why you commented out the "Auth" line though? Have you tried uncommenting that? Also, try printing $! in the error as well to try and get more information.

    Regards,

    Jeff

    Comment

    • RonB
      Recognized Expert Contributor
      • Jun 2009
      • 589

      #3
      Why would you expect it to work?

      You need to pass YOUR connection info, not someone else's that is on a private network via a vpn connection.

      Mail::Sender::E asy is a little outdated. It hasn't been updated since 2006.

      There are a number of other more up to date modules. For simplicity of use, I prefer MIME::Lite.

      Comment

      Working...