LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-16-2005, 05:23 PM   #1
Cool_Hand_Luke
Member
 
Registered: Feb 2005
Posts: 40

Rep: Reputation: 15
Anyone one know why this doens't work?


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.
 
Old 03-16-2005, 11:05 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
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.
 
Old 03-16-2005, 11:43 PM   #3
puffinman
Member
 
Registered: Jan 2005
Location: Atlanta, GA
Distribution: Gentoo, Slackware
Posts: 217

Rep: Reputation: 31
Also,

Code:
use strict;
may help you find mysterious errors that produce no discernable output otherwise.
 
Old 03-17-2005, 08:52 PM   #4
Cool_Hand_Luke
Member
 
Registered: Feb 2005
Posts: 40

Original Poster
Rep: Reputation: 15
I got everything working...

Basically I had to use my local SMTP server for my ISP.. then it works fine.


Does anyone know how to write code using Net::SMTP with MSN?

Cheers,

Luke
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LFS Book Chapter 6 - 1st step (chroot to /mnt/lfs) doens't work bauld Linux From Scratch 11 03-15-2006 12:31 AM
ftp through M$ explorer doens't work m2azer General 4 09-23-2005 09:44 AM
New HD doens't recognized by MDK 9.2 Beised Linux - Hardware 1 07-19-2004 05:29 AM
New HD doens't recognized by MDK 9.2 Beised Mandriva 1 07-16-2004 02:04 PM
I need a new GNOME cause my currently one doens't work thugzclub Linux - Software 1 04-12-2002 09:36 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration