ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Ok, I get no errors.. but I get no email eithier All I want is to send myself an email with the form results...
Anyhelp would be great!
Quote:
#!/usr/bin/perl -wT
use CGI ':standard';
use warnings;
use Mail::Sendmail;
use Net::SMTP;
# Declaring Variables
$test= $ENV{'HTTP_USER_AGENT'};
$version = $CGI::VERSION;
$vemail = param('vemail'); #gets from first.html
$from="lukeharris_79l\@msn.com";
$to="lukeharris_79\@msn.com";
$subject="I\'m sending myself a test e-mail!";
$retpath = "lukeharris_79\@msn.com";
$name = 'Luke Harris';
$mess ='testing';
#Start of trying to send mail
$smtp = Net::SMTP->new('smtp.cogeco.ca', Timeout => 60);
die "Failed to connect to server" unless $smtp;
$smtp->mail($ENV{USER}); #not sure what this dies
$smtp->mail($from);
$smtp->to($to);
$smtp->data();
$smtp->datasend("To: lukeharris_79\@msn.com");
$smtp->datasend("From: lukeharri_79\@msn.com\n");
$smtp->datasend("Subject: Yahoo it worked\n");
$smtp->datasend("\n");
#$smtp->datasend("Hello World\n");
$smtp->datasend("A simple test message\n");
$smtp->dataend();
$smtp->quit();
# Just test code to check form
print "Content-type: text/html\n\n";
print "<html><head></head><body>";
print "<H1>HELLO WORLD!</H1>\n";
print "your viewing this page with $test <br>" ;
print "your email is $vemail <br>";
print "your using CGI.pm version $version<br>";
#print "server admins email is $email<br>";
print "subject is $subject<br>";
print "to is $to<br>";
print "path is $sendmailpath<br>";
print "from is $from<br>";
print "</body></html>";
Last edited by Cool_Hand_Luke; 03-16-2005 at 07:01 PM.
Check your /var/log/maillog for errors sending mail out. It's possible the remote mail server is denying the connection. This seems somewhat likely as it looks like you're trying to route mail to/from a msn account through a cogeco.ca mail server, which may be misinterpreted as an attempt to do spam relaying. You could probably also add some error checking to the datasend calls ... it's possible that the connection is dying mid stream.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.