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

mailer test

by naildownx (Beadle)
on Jul 06, 2009 at 21:09 UTC ( [id://777685]=perlquestion: print w/replies, xml ) Need Help??

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

I am fairly new to Perl and I need a simple mailer test script that I can run from my terminal so that I can know if sendmail is set up properly...This needs to be a script that has been tested on a proper setup already and it works and then I can change the email to and from to test my sendmail server to see if it works. I have tried a couple I have found on the net but I thought it might be easiest to seek out the Monks to help me with a simple light weight testermail.pl...THanks for the help!

Replies are listed 'Best First'.
Re: mailer test
by marto (Cardinal) on Jul 06, 2009 at 21:15 UTC

    You could look at using the MIME::Lite module, the documentation has some basic examples you could use to send your test mail from the command line.

    If you need help with installing modules see Installing Modules from the tutorials section of this site.

    Hope this helps

    Martin

      I will try this out marto...but I would still love if someone has a script already made to test mail...let me know and I will send you my email address. Thanks
        I found an excellent example of making one on a site and I was able to configure it and it worked like a charm! And it uses MIME::Lite so kudos to marto! Thanks bro! CASE CLOSED! I didn't even need Sendmail for this to work! Excellent! Below is the script I found (I modified it a bit so I could get it through my head...Original link is here http://www.bernzilla.com/item.php?id=483 =======================================================
        #!/usr/bin/perl # use MIME::Lite package use MIME::Lite; # set up email $to = "toemail\@gmail.com"; $from = "fromemail\@inbox.com"; $subject = "Email Sent via Perl"; $message = "This email was sent using Perl."; $file = "sample.txt"; # send email email($to, $from, $subject, $message, $file); # email function sub email { # get incoming parameters local ($to, $from, $subject, $message, $file) = @_; # create a new message $msg = MIME::Lite->new( From => $from, To => $to, Subject => $subject, Data => $message ); # add the attachment $msg->attach( Type => "text/plain", Path => $file, Filename => $file, Disposition => "attachment" ); # send the email MIME::Lite->send('smtp', 'smtp.yourisp.net', Timeout => 60); $msg->send(); }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (7)
As of 2024-04-24 09:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found