Submitted by ramesh_ps1 on Fri, 05/11/2007 - 06:31.
( categories: perl questions )
Hi,
I want to send mail from my solaris machine using perl.
I used couple of examples available online but none of them worked for me.
Is there any specefic configuration to be done to use the commands like mail/mailx?
Suggest some alternate options to do the same.
Thanks and regards,
Ramesh.
Re: How to send mail from perl on Solaris 10
Submitted by toshiro on Fri, 05/11/2007 - 17:10.
How did you write the script? Did you use Mail::Send as in this example?
You have to be sure first that your Solaris box can properly send mail; is sendmail configured correctly?

sample script to sending an email using perl
#!/usr/bin/perl
print "Content-type: text/html\n\n";
$title='Perl Mail demo';
$to='MAIL ADDRESS TO SEND TO';
$from= 'webmaster@YOURDOMAIN.COM';
$subject='YOUR SUBJECT';
open(MAIL, "|/usr/sbin/sendmail -t");
## Mail Header
print MAIL "To: $to\n";
print MAIL "From: $from\n";
print MAIL "Subject: $subject\n\n";
## Mail Body
print MAIL "This is a test message from Cyberciti.biz! You can write your
mail body text here\n";
close(MAIL);
Robert Lee Binkley Jr