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

Re: [cobalt-users] SMTP from site on same server



You can use the following code within your CGI program, to send email
through an STMP server.

# Change these
 $mailbodydata = "The body text.";
 $sender  = "Your Name <your\@name.com>";
 $subject = "The subject";
 $recipient = "The Recipient <the\@recipient.com>";
 $mailserver = www.yoursmtpserver.com;

# The code
 use SendMail;
 $obj=new SendMail($mailserver,25);
 $obj->From($sender);
 $obj->Subject($subject);
 $obj->To($recipient);
 $obj->setMailBody($mailbodydata);

 if($obj->sendMail()!=0){
  print$obj->{'error'}."\n";
 }

 $obj->reset();

Greetings,

Martin
www.isaeus.nl