/ Published in: PHP
This is a little snippet to prevent sending emails to customers, in a local development environment, with Swiftmailer.
I didn't find any documentation about the RedirectPlugin, so I made this example.
Please refer to the official documentation to install Swiftmailer.
I didn't find any documentation about the RedirectPlugin, so I made this example.
Please refer to the official documentation to install Swiftmailer.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php $local = true; // Create the Mailer using any Transport $mailer = Swift_Mailer::newInstance( Swift_SmtpTransport::newInstance('smtp.example.org', 25) ); // Create the Message $message = Swift_Message::newInstance() ->setSubject('My subject') ->setBody('My content'); if( $local ) { // Register the RedirectPlugin, only in local development environment // and then, no email will be sent to [email protected] or [email protected] or [email protected] } // Send the Message $mailer->send($message);
URL: http://swiftmailer.org/docs/introduction.html