[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] perl script-generated sendmail headers



Simple question: why use sendmail then?  Why not open a port to the
remote SMTP server?

from http://www.mannyjuan.com/tricks.htm

    use Net::SMTP;

    $smtp = Net::SMTP->new($mailserver);	# connect to an SMTP server
    $smtp->mail($myemail);			# use the sender's address here
    $smtp->to($email);				# recipient's address
    $smtp->data();				# Start the mail

    # Send the header.
    $smtp->datasend("To: $email\n");
    $smtp->datasend("From: $myemail\n");
    $smtp->datasend("Subject: Subject\n");
    $smtp->datasend("\n");

    # Send the body.
    $smtp->datasend("this place is here - wish you were beautiful!\n");
    ...
    $smtp->datasend("\n");
    $smtp->dataend();				# Finish sending the mail
    $smtp->quit;				# Close the SMTP connection

tim 

-- 
Mechanical Engineers build weapons.  Civil Engineers build targets.