Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Email an Attachment via Gmail

by anujsethi91 (Initiate)
on Apr 05, 2013 at 07:57 UTC ( #1027093=perlquestion: print w/ replies, xml ) Need Help??
anujsethi91 has asked for the wisdom of the Perl Monks concerning the following question:

hi guys, can you please tell me how do i install the module Email::Send::SMTP::Gmail, i've tried with cpan, and ppm install, but its showing "error installing package, don't know what it is, could not locate ppd file!!. Else can you tell me how do i send an attachment via gmail using perl. thanks guys. the code im using is given below, its showing the error "BEGIN failed at line 4"
use strict; use warnings; use Email::Send::SMTP::Gmail; my $mail=Email::Send::SMTP::Gmail->new( -smtp=>'smtp.gmail.com', -login=>'myid', -pass=>'mypasswrd'); $mail->send(-to=>'sendtoid', -subject=>'Hello!', -body=>'Just testing +it', -attachments=>'C:/strawberry/perl/test.txt'); $mail->bye;
guys i used cpan Gmail, and it worked just fine, but now i'm getting a whole new kind of an error, my code is the same as above but now its showing :: 'Can't locate object method "new" via package "Email::Send::SMTP::Gmail" <perhaps you forgot to load "Email::Send::SMTP::Gmail"> at email1.pl line 5' please help

Comment on Email an Attachment via Gmail
Download Code
Replies are listed 'Best First'.
Re: Email an Attachment via Gmail
by davido (Archbishop) on Apr 05, 2013 at 08:18 UTC

    What version are you trying to install? Version 0.40 seemed to have a zero-percent success rate with the smokers, while 0.43 seems to have 100% success among the smokers that have tested it.

    When you try cpan install Email::Send::SMTP::Gmail, what error messages do you get?

    Update: Just to check, I ran "cpanm Email::Send::SMTP::Gmail", and got a successful installation on the first try. There were a total of five distributions pulled in on my system (the target plus its dependencies).


    Dave

      Hi davido, the changes file only has entries up to v0.40, and you are right that there is only one test (t/00-load.t), but the current version of Email::Send::SMTP::Gmail is v0.96 FWIW. That's the version that cpan Email::Send::SMTP::Gmail just installed on my machine.


      The way forward always starts with a minimal test.
Re: Email an Attachment via Gmail
by hdb (Prior) on Apr 05, 2013 at 12:12 UTC

    Same problem for me. Try

    cpan install Gmail
      thank you it worked perfectly!! but now that its detecting the module, i am stuck at a new problem. my code is the same as above but now its showing :: 'Can't locate object method "new" via package "Email::Send::SMTP::Gmail" <perhaps you forgot to load "Email::Send::SMTP::Gmail"> at email1.pl line 5' please help

        Back to my original question of you: What do you see when you type:

        cpan install Email::Send::SMTP::Gmail

        Dave

Re: Email an Attachment via Gmail
by prashantktyagi (Scribe) on Apr 05, 2013 at 12:03 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1027093]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2015-09-03 11:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred temperature scale is:










    Results (107 votes), past polls