Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Sending email via Gmail

by Gangabass (Vicar)
on Jul 22, 2011 at 16:42 UTC ( #916163=perlquestion: print w/replies, xml ) Need Help??
Gangabass has asked for the wisdom of the Perl Monks concerning the following question:

Hi, Monks. I have email sending code which doesn't work without any error messages (by "doesn't work" i mean all seams OK but i have no message in my mail box):
use strict; use warnings; use Email::Send; use Email::Simple::Creator; report_update(); sub report_update { my $mailer = Email::Send->new( { mailer => 'SMTP::TLS', mailer_args => [ Host => '', Port => 587, User => $CONFIG{EMAIL_USER}, Password => $CONFIG{EMAIL_PASS}, Hello => 'localhost', ] } ); my $email = Email::Simple->create( header => [ From => $CONFIG{EMAIL_USER}, To => $CONFIG{TARGET_EMAIL}, Subject => 'Updated info finded!', ], body => 'Updated info finded!', ); eval { $mailer->send($email) }; die "Error sending email: $@" if $@; print "Finished!\n"; }
Could you give me a hint what's wrong with it? UpdateThanks all for the answers. Now i'm using Email::Send::Gmail and the problem is solved. But the question is still in my head: why this code don't work on one of my machine and works on another?

Replies are listed 'Best First'.
Re: Sending email via Gmail
by wind (Priest) on Jul 22, 2011 at 17:06 UTC
Re: Sending email via Gmail
by afoken (Abbot) on Jul 22, 2011 at 16:56 UTC

    Without further debugging: When you talk to, don't pretend to be "localhost", i.e. Use your real hostname. If you don't know it, use DNS to find it, or use your external IP address.


    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
      You're right, using "localhost" is a bad idea but i'm sure this is not an issue here because same code is working on another machine.
Re: Sending email via Gmail
by zentara (Archbishop) on Jul 22, 2011 at 17:12 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://916163]
Approved by ww
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2018-03-18 23:36 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (231 votes). Check out past polls.