Latest technology news, trends and developers guide for business application. Visit this space for more tech updates.

Let’s work on your exciting new project together!

Solution to send mails from development systems/servers

Enterprise Solutions, Web Apps, Web App Development, Cloud Technology, Laravel Web Development

I faced this issue many times when I had to test the mail feature in my projects. I then had to add SMTP library separately to check in different web based mails like Google Mail, Yahoo Mail, Outlook, etc. or need to upload the code to production servers where mails worked.

Mandrill (sends to any really account – preferred for UAT and Production systems) and Mailtrap (sends to single account for any email address – preferred for Development systems) provides a very good way to do this. With small changes in configuration of the server we can easily use this to send mails to any account without having SPAM issues.

Mandrill can also be a very useful tool to send mails in production if Client has budget or the number of mails are very limited. It provides tracking tools, graph and we can even configure BCC on all mails without changing code for debugging purpose.

>Today, I will cover how to configure it in Postfix (Linux Ubuntu/CentOS/Amazon Linux) and XAMPP using Sendmail.


Installing Postfix

Installing Postfix is easy, just run this command as root:


Configuring in Postfix

Basically, you need to create a password file so that Postfix can authenticate to Gmail’s servers. You do this by creating a file named sasl_passwd in /etc/postfix. Replace smtp_user and smtp_passwd with their respective values.


Step 1A (Mandrill):
echo “    smtp_user:smtp_passwd” > /etc/postfix/sasl_passwd

Step 1B (Mailtrap):
echo “    smtp_user:smtp_passwd” > /etc/postfix/sasl_passwd


You then hash that file so that the password is not stored in clear text. This command will create a file named sasl_passwd.db in the /etc/postfix/ directory.

Step 2: postmap hash:/etc/postfix/sasl_passwd

After that is done, add these to the bottom of /etc/postfix/ This is assuming that your root certificates installed from openssl are located in /etc/pki/tls/certs/ca-bundle.crt.

Step 3A (Mandrill):

smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous

# Secure channel TLS with exact nexthop name match.
smtp_tls_security_level = secure
smtp_tls_mandatory_protocols = TLSv1
smtp_tls_mandatory_ciphers = high
smtp_tls_secure_cert_match = nexthop
smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt
relayhost =

tep 3B (Mailtrap):

smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
relayhost =


After that is done, restart postfix:

Step 4: service postfix restart

Now test it to make sure it is working. Run this:

Step 5: mail email@domain

Fill in the subject, put something in the body and then type a . and hit enter.

If all went well, you should get an email at the email address you entered. If you do, you can delete the file that has the password.

Step 6: rm /etc/postfix/sasl_passwd

If it did not work, check the log to see what happened.

Step 7: tail /var/log/maillog

Everything should be good after you get everything set up, so enjoy your new SMTP relay with Mandrill or Mailtrap!


Configuring in XAMPP

To do the same in XAMPP, we need to add sendmail. We can get sandmail from

Extract the zip inside XAMPP directory.

Open sendmail.ini and change the settings inside as below:



auth_username=[Email address for Mandrillapp or Mailtrap username here]
auth_password=[API key for Mandrill or password for]
[Email address]

Open php.ini, uncomment sendmail_path and change the path to where you have extracted sendmail:

[mail function]
sendmail_path = “\”C:\xampp\sendmail\sendmail.exe\” -t”


Hope this helps you to test your mails that you develop.


Solution Analysts Ranked Top Software Development Company by GoodFirms

Solution Analysts, a mobility and IoT solutions company based in the Indian city of Ahmedabad,...

Three Reasons Swift is Ready for the Enterprise

Swift was launched by Apple in 2014 as a new programming language to which it...

Open Source Technologies in IoT & Managing Security

Internet of Things (IoT) will no doubt integrate the world and its workings in a...

We are always happy to hear from you - Share your business requirements. Our business experts will reach you shortly


Select Your Requirement

Secure : We'll ensure, all the information provided by you will not be shared with anyone and your details are completely safe.

We respect your privacy. *Privacy Policy

Select Your Requirement

Secure : We'll ensure, all the information provided by you will not be shared with anyone and your details are completely safe.

We respect your privacy. *Privacy Policy