<?php /** * o------------------------------------------------------------------------------o * | This package is licensed under the Phpguru license. A quick summary is | * | that for commercial use, there is a small one-time licensing fee to pay. For | * | registered charities and educational institutes there is a reduced license | * | fee available. You can read more at: | * | | * | http://www.phpguru.org/static/license.html | * o------------------------------------------------------------------------------o * * � Copyright 2008,2009 Richard Heyes */ /** * This example includes setting a Cc: and Bcc: address */ use RMail\Rmail; /** * Now create the email it will be attached to */ $mail = new Rmail(); $mail->setFrom('Richard <*****@*****.**>'); $mail->setSubject('Test email'); $mail->setCc('*****@*****.**'); $mail->setBcc('*****@*****.**'); $mail->setText('Sample text'); $result = $mail->send(array('*****@*****.**')); ?> Message has been sent
* | http://www.phpguru.org/static/license.html | * o------------------------------------------------------------------------------o * * � Copyright 2008,2009 Richard Heyes */ /** * This example shows you how to create an email with another email attached */ use RMail\Rmail; /** * Create the attached email */ $attachment = new Rmail(); $attachment->setFrom('Bob <*****@*****.**>'); $attachment->setText('This email is attached.'); $attachment->setSubject('This email is attached.'); $body = $attachment->getRFC822(array('*****@*****.**')); /** * Now create the email it will be attached to */ $mail = new Rmail(); $mail->addAttachment(new StringAttachment($body, 'Attached message', 'message/rfc822', new SevenBitEncoding())); $mail->addAttachment(new FileAttachment('example.zip')); $mail->setFrom('Richard <*****@*****.**>'); $mail->setSubject('Test email'); $mail->setText('Sample text'); $result = $mail->send($addresses = array('*****@*****.**')); ?> Message has been sent to: <?php echo implode(', ', $addresses);
$mail->setText('Sample text'); /** * Set the HTML of the email. Any embedded images will be automatically found as long as you have added them * using addEmbeddedImage() as below. */ $mail->setHTML('<b>Sample HTML</b> <img src="background.gif">'); /** * Set the delivery receipt of the email. This should be an email address that the receipt should be sent to. * You are NOT guaranteed to receive this receipt - it is dependent on the receiver. */ $mail->setReceipt('*****@*****.**'); /** * Add an embedded image. The path is the file path to the image. */ $mail->addEmbeddedImage(new fileEmbeddedImage('background.gif')); /** * Add an attachment to the email. */ $mail->addAttachment(new fileAttachment('example.zip')); /** * Send the email. Pass the method an array of recipients. */ $address = '*****@*****.**'; $result = $mail->send(array($address)); ?> Email has been sent to <?php echo $address; ?> . Result: <?php var_dump($result);