Hi everyone,
I'm trying to create a cgi that takes information from a user input form and sends the information to an email account. There are apparently quite a few different modules out there to do this but I've opted for Mail::Sender. This module requires an SMTP server address and I'm not entirely sure what to use. Is this something I can set-up on my computer??
Here's the sample code:
#!/perl/bin/perl -wT
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
use Mail::Sender;
#use strict;
print header;
print start_html( "Results" );
$sender = new Mail::Sender {
smtp => 'www.2wire.com',
from => 'heygohey@hotmail.com',
on_errors => undef,
}
or die "Can't create the Mail::Sender object: $Mail::Sender::Error\n";
$sender->Open({
to => 'heygohey@hotmail.com',
subject => 'Sorry, I\'ll come later.'
})
or die "Can't open the message: $sender->{'error_msg'}\n";
$sender->SendLineEnc("I'm sorry, but thanks to the lusers, I'll come a
+t 10pm at best.");
$sender->SendLineEnc("\nHi, Jenda");
$sender->Close()
or die "Failed to send the message: $sender->{'error_msg'}\n";
print end_html;
Other notes that might be helpful:
- I'm running an Apache server.
- I do not have a domain name.
- Windows.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.