How to use PHP Swift mail library Print

  • 64

We have added this library to all our servers, so now you can use it without having to upload it to the server. Here are the steps to use it:

The library is located in /usr/local/php/Swift and it will kept up to date with new releases.

  1.   
  2. require_once "Swift/lib/Swift.php";  
  3. require_once "Swift/lib/Swift/Connection/NativeMail.php";  
  4.   
  5. $swift = new Swift(new Swift_Connection_NativeMail("[email protected]"));  
  6. $message = new Swift_Message("My subject", "My body"); 

  7. if ($swift->send($message"[email protected]""[email protected]"))  
  8. {  
  9. echo "Message sent";  
  10. }  
  11. else  
  12. {  
  13. echo "Message failed to send";  
  14. }  
  15.   
  16. ?>  
send($message, "[email protected]", "[email protected]"))
{
echo "Message sent";
}
else
{
echo "Message failed to send";
}

?>

For more information check out the Swift documentation which is pretty good.


Was this answer helpful?

« Back