Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't get NET::SMTP to work... Can someone help?

Status
Not open for further replies.

NeilFawcett

Programmer
Mar 19, 2004
30
0
0
GB
Here's a script I've written:-

Code:
#!/usr/bin/perl
use Net::SMTP;

print "Content-type: text/html\n\nMail Test<BR>";

$smtp = Net::SMTP->new('mail.mydomain.com'); 
$smtp->mail("test\@mydomain.com"); 
$smtp->to("my\@emailaddress.com"); 
$smtp->data(); 
$smtp->datasend("Hello!\n\n"); 
$smtp->dataend(); 
$smtp->quit();

print 'done';
exit;

Obviously I change the "mydomain" and "my@emailaddress", but no email arrives.

I've checked and my server company states the smtp path is "mail.domain.com"...
 
Neil,
Code:
$smtp = Net::SMTP->new('[i]mail.mydomain.com[/i]');

This should be mail.e.g.neilfawcett.com not mail.domain.com. The isp is probably giving a generic answer. Try even your server IP address

HTH
--Paul
 
Sorry my program did actually work, it's just that it took nearly an hour for the test emails to arrive... Hence me thinking there was a problem!
 
In these cases use the debug flag

$smtp = Net::SMTP->new('mail.mydomain.com', Debug=>1);

It will show you the transaction in your error log so you can immediately confirm that it was received on the MTA side.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top