Net::smtp - Did this work


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Net::smtp - Did this work
# 1  
Old 04-28-2005
Net::smtp - Did this work

Hi,

I have read the related posts by perleo and those who assisted. I wish to do a similar thing, in that I wish to use the Net:smtp module.

I have downloaded it and followed the instructions for the install.

When I check the perldoc net::smtp, the information returns (thus showing it has installed correctly? sorry no idea where it lives on Windows XP)

I then tried the following code

#!/bin/perl

sub send_mail {
my($to, $from, $subject, @body)=@_;

use Net::SMTP;


my $relay="smtp.ntlworld.com";
my $smtp = Net::SMTP->new($relay);
die "Could not open connection: $!" if (! defined $smtp);

$smtp->mail ($from);
$smtp->to ($to);

$smtp->data();
$smtp->datasend("To:$to\n");
$smtp->datasend("From: $from\n");
$smtp->datasend("Subject: $subject\n");
$smtp->datasend("\n");
foreach(@body) {
$smtp->datasend("$_\n");
}
$smtp->dataend();
$smtp->quit;
}

@body=("This is perl, does it work.Does anything work?");
send_mail('cheng_alchemy@hotmail.com', 'cheng_alchemy\@hotmail', 'Subject of Perl',@body);

I know nothing about perl (kornshell background and unix so I know nothing about windows either - sorry) and have blatently copied it from a book I am reading.

I am running version 5.6.1 on windows XP.

When I execute the script , it doesn't report any errors and I am assuming it hasn't worked as I haven't had any emails (waited a couple of hours). Does anyone have any ideas?

No tight deadline to work to, just my own education.

Cheers,

Cheng
# 2  
Old 05-06-2005
An Answer - sort of

Hi,

having investigated this further. It would appear that the recipient e.g. my hotmail address bounces the email as the header is blank. Consequently the mail server believes it to be either spam or undesirable. It therefore kills the email so it doesn't just bounce back and forth.

The reason why mail servers now do this is principally for the sake of spammers. So, if I alter my email to include a header and therefore become traceable, they will in all likelihood forward on the mail.

Cheers,

Cheng
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. IP Networking

Discussion at work, would a router work pluging a cable in wan1 and lan1?

hi all. and sorry for the random question, but this sparkled a raging flame-war at work and i want more points of view situation a router, with linux of some sort, dhcp client requesting for ip in wan1 (as usual with wan ports) dhcp server listening in lan1, and assigning ip (as usual... (9 Replies)
Discussion started by: broli
9 Replies

2. Shell Programming and Scripting

My script work on Linux but not work in sunos.

My script work on Linux but not work in sun os. my script. logFiles="sentLog1.log sentLog2.log" intial_time="0 0" logLocation="/usr/local/tomcat/logs/" sleepTime=600 failMessage=":: $(tput bold)Log not update$(tput rmso) = " successMessage="OK" arr=($logFiles)... (7 Replies)
Discussion started by: ooilinlove
7 Replies

3. Shell Programming and Scripting

MIME Type detection for Net::SMTP

I've spent a good two weeks on trying to figure out a proper way to get the mime type of a file. The "file" command on the Sparc machine I'm working on is an older version and does not support the --mime flag. It outputs things like: somefile.pdf: Adobe Portable Document Format (PDF) v1.5 ... (3 Replies)
Discussion started by: mrwatkin
3 Replies

4. Shell Programming and Scripting

Perl variables inside Net::Telnet::Cisco Module doesn't work

I am writing perl script to configure Cisco device but Variables inside Net::Telnet::Cisco Module doesn't work and passed to device without resolving. Please advise. here is a sample of script: use Net::Telnet::Cisco; $device = "10.14.199.1"; ($o1, $o2, $o3, $o4) = split(/\./,$device);... (5 Replies)
Discussion started by: ahmed_zaher
5 Replies

5. Shell Programming and Scripting

Net::SMTP via PERL is not working in few cases

We are getting some special scenarios where Net::SMTP is not working for some mails. we are sending a similar kind of data via mails but some of the mails are not received. After checking the Net::SMTP in debug mode we found below difference: Good One - (Mail sent properlly) --- -----... (0 Replies)
Discussion started by: NIMISH AGARWAL
0 Replies

6. Shell Programming and Scripting

Sending Attachment using MIME::Lite and Net::SMTP

Hello, I'm a newbie perl scriptor and i'm trying to figure out why i can't send an email using MIME::Lite with Net::SMTP. I keep receiving the following error: SMTP MAIL command failed: 5.7.1 Helo invalid . at attach1.pl line 31 The error keeps coming from the very last line... (2 Replies)
Discussion started by: xmaverick
2 Replies

7. Shell Programming and Scripting

Net::SSLeay or Net::FTPSSL

Hello, I ran into an issue in one of my monitoring scripts. If I use the public ip address in my connection string everything works, but if I switch the connection string ip to 127.0.0.1 or the internal ip I get, " Connection refused at... (1 Reply)
Discussion started by: Styles
1 Replies

8. UNIX for Dummies Questions & Answers

Script doesn't work, but commands inside work

Howdie everyone... I have a shell script RemoveFiles.sh Inside this file, it only has two commands as below: rm -f ../../reportToday/temp/* rm -f ../../report/* My problem is that when i execute this script, nothing happened. Files remained unremoved. I don't see any error message as it... (2 Replies)
Discussion started by: cheongww
2 Replies

9. SCO

Net Work Printer Error.

sco 505, I have installed a HPnetwork printer, but when I test printing I get. =============================================================== Checking that tsie.tsiequ.com is on the printer's access list ... /usr/lib/hpnp/cfg/canaccess phaser740 Printer access test failed. Add... (2 Replies)
Discussion started by: franruiz
2 Replies
Login or Register to Ask a Question