Login   Register  
PHP Classes
elePHPant
Icontem

File: addMail.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of solomongaby  >  Newsletter Queue  >  addMail.php  >  Download  
File: addMail.php
Role: Example script
Content type: text/plain
Description: example adding a mail in the queue
Class: Newsletter Queue
Queue newsletters in MySQL for delivering later
Author: By
Last change: added new fields
Date: 6 years ago
Size: 1,011 bytes
 

Contents

Class file image Download
<?php
$moduleRoot
=dirname(__FILE__);
require(
$moduleRoot.'class.phpmailer.php');
require(
$moduleRoot.'class.newsletter.php');
require(
$moduleRoot.'easy-mysql-class.php');

$mysql= new mysql('localhost' 'mysqlUser''mysqlPassw''mysqlDB' );
$mysql->connect();

$newsletter= new newsletter();
$newsletter->addMysqlObg($mysql);

        
$data=array('method'           => 'SMTP',
                    
'From'             => 'myadress@domain.com',
                    
'FromName'         => 'My Name',
                    
'Host'             => 'mail.domain.com',
                    
'SMTPAuth'         => true,
                    
'Username'         => 'myadress@domain.com',
                    
'Password'         => 'password',
                    
'recepientMail' => 'joe@yahoo.com',
                    
'recepientName' => 'Joe Silva',
                    
'subject'       => 'Hello friend',
                    
'body'          => 'How are you !',
                    
'ContentType'   => 'text/html',
                    
'priority'      => '3',
                    
'SendDate'      => time(),
                    );
$add=$newsletter->addMail($data);
if (
$add===false) echo $newsletter->errorMsg;

?>