Log In

This guide provides a simple script to send out E-Mail using your SMTP2GO Account. You may refer the following pages for more options and details:
How to send an Email in Symfony.
Creating Messages in Symfony.

Step 1

Please change the following variables in this guide:

Sender Name: the sender’s name.

sender@example.com: the sender’s email address.

Recipient Name: the recipient’s name.

recipient@example.com: the recipient’s email address.

USERNAME: your SMTP username.

PASSWORD: your SMTP password.

Step 2

Enable the SwiftmailerBundle in your kernel:

public function registerBundles()
$bundles = array(
// ...

new SymfonyBundleSwiftmailerBundleSwiftmailerBundle(),

// ...

Step 3

Make changes to the Configuration file (config.yml) as below:

# Swiftmailer Configuration
transport: smtp
host: mail.smtp2go.com
username: USERNAME
password: PASSWORD
port: 2525 // 8025, 587 and 25 can also be used.
encryption: tls

Step 4

Add the following code in your application where it is required:

$message = Swift_Message::newInstance()
->setSubject('Your Subject')
->setFrom(array('sender@example.com' => 'Sender Name'))
->setTo(array('recipient@example.com' => 'Recipient Name'))
->setBody('Your HTML message.','text/html')
->addPart('Your Text message', 'text/plain');

Ready for better email delivery?

Try SMTP2GO free for as long as you like:

Try SMTP2GO Free → Paid plans available for over 1,000 emails/month.