perl_dan has asked for the wisdom of the Perl Monks concerning the following question:

I run a single computer from home. OS is W8.1 Pro and I program and execute on DwimPerl. The following code:
#!/usr/bin/perl use 5.010; use Email::MIME; my $message = Email::MIME->create( header_str => [ From => 'alizze@name.se', To => 'myown@gmail.com', Subject => 'Happy birthday!', ], attributes => { encoding => 'quoted-printable', charset => 'ISO-8859-1', }, body_str => "Happy birthday to you!\n", ); # send the message use Email::Sender::Simple qw(sendmail); sendmail($message);
results in:
"unable to establish SMTP connection Trace begun at C:\Dwimperl\perl\site\lib\Email\Sender\Transport\SMTP.p +m line 95 Email::Sender::Transport::SMTP::_throw('Email::Sender::Transport::SMTP +=HASH(0x2cf10dc)', 'unable to establish SMTP connection') called at C +:\Dwimperl\perl\site\lib\Email\Sender\Transport\SMTP.pm line 62 Email::Sender::Transport::SMTP::_smtp_client('Email::Sender::Transport +::SMTP=HASH(0x2cf10dc)') called at C:\Dwimperl\perl\site\lib\Email\Se +nder\Transport\SMTP.pm line 104 Email::Sender::Transport::SMTP::send_email('Email::Sender::Transport:: +SMTP=HASH(0x2cf10dc)', 'Email::Abstract=ARRAY(0x41fd64)', 'HASH(0x41f +d74)') called at C:\Dwimperl\perl\site\lib\Email\Sender\Role\ CommonSending.pm line 27 Email::Sender::Role::CommonSending::__ANON__ at C:\Dwimperl\perl\site\ +lib\Try\Tiny.pm line 76 eval {...} at C:\Dwimperl\perl\site\lib\Try\Tiny.pm line 67 Try::Tiny::try('CODE(0x2e37d44)', 'Try::Tiny::Catch=REF(0x2cce4ec)') c +alled at C:\Dwimperl\perl\site\lib\Email\Sender\Role\CommonSending.pm + line 37 Email::Sender::Role::CommonSending::send('Email::Sender::Transport::SM +TP=HASH(0x2cf10dc)', 'Email::Abstract=ARRAY(0x41fd64)', 'HASH(0x2e37f +44)') called at C:\Dwimperl\perl\site\lib\Email\Sender\Simple .pm line 110 Email::Sender::Simple::send_email('Email::Sender::Simple', 'Email::Abs +tract=ARRAY(0x41fd64)', 'HASH(0x41fe54)') called at C:\Dwimperl\perl\ +site\lib\Email\Sender\Role\CommonSending.pm line 27 Email::Sender::Role::CommonSending::__ANON__ at C:\Dwimperl\perl\site\ +lib\Try\Tiny.pm line 76 eval {...} at C:\Dwimperl\perl\site\lib\Try\Tiny.pm line 67 Try::Tiny::try('CODE(0x41fde4)', 'Try::Tiny::Catch=REF(0x2b8b6cc)') ca +lled at C:\Dwimperl\perl\site\lib\Email\Sender\Role\CommonSending.pm +line 37 Email::Sender::Role::CommonSending::send('Email::Sender::Simple', 'Ema +il::MIME=HASH(0x2ceab2c)') called at C:\Dwimperl\perl\site\lib\Sub\Ex +porter\Util.pm line 69 Sub::Exporter::Util::__ANON__('Email::MIME=HASH(0x2ceab2c)') called at + script.pl line 21 Press any key to continue . . ."
What's missing?

Replies are listed 'Best First'.
Re: unable to establish SMTP connection
by flexvault (Monsignor) on Apr 27, 2015 at 20:07 UTC

    Welcome perl_dan,

    Quickly before anyone else sees your unformatted code, put code tags around the script and update. You'll get a lot more positive answers.

    #!/usr/bin/perl use 5.010; use Email::MIME; my $message = Email::MIME->create( header_str => ...

    Regards...Ed

    "Well done is better than well said." - Benjamin Franklin

Re: unable to establish SMTP connection
by ww (Archbishop) on Apr 27, 2015 at 20:45 UTC
Re: unable to establish SMTP connection
by kcott (Archbishop) on Apr 28, 2015 at 09:11 UTC
Re: unable to establish SMTP connection
by flexvault (Monsignor) on Apr 28, 2015 at 14:24 UTC

    Hello perl_dan,

    Welcome to the Monastery.

      "unable to establish SMTP connection..."
    I downloaded your script and it worked! You should have the result in your inbox, and your Perl part is working. I suspect that 'sendmail' or another dependency isn't configured properly.

    If you don't get the email, let me know.

    Good Luck...Ed

    "Well done is better than well said." - Benjamin Franklin