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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Not Receiving Mail

Status
Not open for further replies.

dshaw21369

Programmer
Jul 8, 2002
64
I'm trying to send an email to myself with the code shown below. and I verified the location of send mail and Im still not receiving emails any suggestions?

open (MAIL, "|/usr/lib/sendmail -oi -t -odq") || die "cant use mail send";
print MAIL "from: denesa.k.shaw\@centerpointenergy.com\n";
print MAIL "To: denesa.k.shaw\@centerpointenergy.com\n";
print MAIL "Subject: Rollback\n";
print MAIL "email message";
close MAIL;

Thanks
 
I assume that you're sure that sendmail is in the usr/lib directory. So, try eliminating some of the sendmail switches:

open (MAIL, "|/usr/lib/sendmail -i -t") or die "cant use mail send";
print MAIL "from: denesa.k.shaw\@centerpointenergy.com\n";
print MAIL "To: denesa.k.shaw\@centerpointenergy.com\n";
print MAIL "Subject: Rollback\n";
print MAIL "email message";
close MAIL;


I'd also make it easier by assigning From and To values to variables: $from = "denesa.k.shaw\@centerpointenergy.com"; call it like this: print MAIL "from: $from\n";

Hope this helps There's always a better way...
 
hi, which platform r u on. bcoz a similar script of mine that used to work on Solaris 2.7 stopped working on 2.8. that was bcoz of some change in solaris 2.8 sendmail.

do let me know if u got this working.. coz i too need it badly. LOL A ship is safe in the harbour, but that's not what it is meant for!!! LOL
 
Hey I tried ur script on solaris 2.7 with first line alone changed like this

open (MAIL, "|/usr/lib/sendmail -t") || die "cant use mail send";

it worked like charm. but it didnt work when i tried on solaris 2.8. u can probably try with -t option alone and c. LOL A ship is safe in the harbour, but that's not what it is meant for!!! LOL
 
Thanks I got it to work!!! appreciate all the help here!
 
How did u get it working?? I'd like to know that coz i need it badly now. LOL A ship is safe in the harbour, but that's not what it is meant for!!! LOL
 
Hi,
I've had a similar problem and now also open the destination email addresses and it works fine. Try this:

$mailprog = "/usr/lib/sendmail";
$email = "denesa.k.shaw\@centerpointenergy.com";


open(MAIL, "| $mailprog $email") or die "cant use mail send";
print MAIL "from: denesa.k.shaw\@centerpointenergy.com\n";
print MAIL "To: $email \n";
print MAIL "Subject: Rollback\n";
print MAIL "email message";
close MAIL;
 
Personally I would have gone:
$mailprog = "/usr/lib/sendmail";
$email = "denesa.k.shaw\@centerpointenergy.com";

open(MAIL, "|", $mailprog") or die "cant use mail send";
print MAIL "from: denesa.k.shaw\@centerpointenergy.com\n";
print MAIL "To: $email \n";
print MAIL "Subject: Rollback\n\n";
print MAIL "email message";
close (MAIL);
 
Oh, and another thing, it looks like you're not using strict, you should look into that. And if you single quote your $email assign, you don't need to escape the @.
$email = 'me@you.com'; # this would work fine

sulfericacid
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top