Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Vasyl Rusanovskyy  >  SMTP or mail function E-mail sending class  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example file
Class: SMTP or mail function E-mail sending class
Send messages via an SMTP server or mail function
Author: By
Last change:
Date: 3 years ago
Size: 1,242 bytes
 

Contents

Class file image Download
<?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 'user@myhost.com';
$Mail->smtp_password 'mypassw';


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

// Example 2 (mail from me)
$Mail->mail_to 'mymail1@mydomain.com; recipient2 name <recipientmail2@mydomain.com>,"recipient name" <recipient@mail.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 user2@site2.com)

$Mail->mail_to 'Recipient Name <recipientmail@domain.com>';
$Mail->subject 'My subject';
$Mail->message 'My message here';
$Mail->from_name 'User2 Name';
$Mail->SendFromMail 'user2@site2.com';

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

?>