Location: PHPKode > scripts > SMTP or mail function E-mail sending script > example.php
<?php 
include "sendmail.class.php";
$Mail = new sendmail();

// Set congif
$Mail->SendMailVia = 'smtp';  // Send via smtp server or mail function
$Mail->smtp_host = 'mail.myhost.com';
$Mail->smtp_port = 25;
$Mail->smtp_user = 'hide@address.com';
$Mail->smtp_password = 'mypassw';


// Example 1 (mail from me)
if($Mail->Send('hide@address.com; recipient2 name <hide@address.com>,"recipient name" <hide@address.com>','My subject','My message here.'))
{
  echo 'message Mail send!';
}
else
{
  echo $Mail->error;
}

// Example 2 (mail from me)
$Mail->mail_to = 'hide@address.com; recipient2 name <hide@address.com>,"recipient name" <hide@address.com>';
$Mail->subject = 'My subject';
$Mail->message = 'My message here';

if($Mail->Send())
{
  echo 'message Mail send!';
}
else
{
  echo $Mail->error;
}


// Example 3 (mail from another user: example hide@address.com)

$Mail->mail_to = 'Recipient Name <hide@address.com>';
$Mail->subject = 'My subject';
$Mail->message = 'My message here';
$Mail->from_name = 'User2 Name';
$Mail->SendFromMail = 'hide@address.com';

if($Mail->Send())
{
  echo 'message Mail send!';
}
else
{
  echo $Mail->error;
}

?>
Return current item: SMTP or mail function E-mail sending script