Sending an email

The API for the WTMail class can be found here

Example code to send an email:

$mail = new WTMail(); 
$mail->setFrom("contact@webtemplate.com.au", "WebTemplate"); 
$mail->setTo("contact@domain.com"); 
$mail->setContent("subject", "<html><body>A HTML Email</body></html>", true); 
$mail->send();

To send an email to multiple people, you can seperate the email addresses with a semicolon, eg:

$mail = new WTMail(); 
$mail->setFrom("contact@webtemplate.com.au", "WebTemplate"); 
$mail->setTo("contact1@domain.com; contact2@domain.com"); 
$mail->setContent("subject", "<html><body>A HTML Email</body></html>", true); 
$mail->send();

To send to multiple people, you can also use the setCC or setBCC methods, eg:

$mail = new WTMail(); 
$mail->setFrom("contact@webtemplate.com.au", "WebTemplate"); 
$mail->setTo("contact1@domain.com"); 
$mail->setCC("contact2@domain.com");
$mail->setBCC("contact3@domain.com");
$mail->setContent("subject", "<html><body>A HTML Email</body></html>", true); 
$mail->send();

Sending an email with an attachment:

$mail = new WTMail(); 
$mail->setFrom("contact@webtemplate.com.au", "WebTemplate"); 
$mail->setTo("contact@domain.com"); 
$mail->addAttachment("image.jpg"); 
$mail->setContent("subject", "<html><body>A HTML Email</body></html>", true); 
$mail->send();

Sending an email with an embedded image:

$mail = new WTMail(); 
$mail->setFrom("contact@webtemplate.com.au", "WebTemplate"); 
$mail->setTo("contact@domain.com"); 
$mail->addEmbeddedImage("image.jpg", "image1"); 
$mail->setContent('subject', '<html><body>A HTML Email<br/> Image: <img src="cid:image1"/>End of Image</body></html>', true); 
$mail->send();