WordPress Local SMTP Email Server with MailTrap and Ajax Contact Form Example

Mailtrap is awesome for development and testing, that provides a fake SMTP server for your development team to test, view and share emails sent from the pre-production environments and test with real data without the risk of spamming real customers.

Various pricing options but of course we’re gonna just speak the free one that allows us to use just one in boxes that all we need a maximum of fifty messages insight per inbox no team member so where’d you only one that he can use this and two emails in boxes so we could have potentially two different emails to test.

1. Register via https://mailtrap.io/register/signup?header
Verify if necessary


2.After login with sign in details access your inboxes via https://mailtrap.io/inboxes

3.Store the SMTP credentials somewhere safe (Select SMTP settings->Integrations->WordPress)

4.You can configure WordPress SMTP by using this code at WordPress active theme functions.php file.

5. Here sample simple ajax contact from with WordPress and MailTrap example.

i. Create new file named “mycontact.php” at WordPress active theme directory Ex : /wp-content/themes/twentyseventeen/mycontact.php and add below code.

ii.Now add below code to send an email to WordPress admin at active theme functions.php file Ex: /wp-content/themes/twentyseventeen/functions.php

iii. Now add “[contact_form]” shortcode to wordpress page/post.

iv. Now access the contact page and send message. Ex : http://localhost/wordpress/index.php/contact/

v. Its appear in mailtrap demo account.

Leave a Reply

Your email address will not be published. Required fields are marked *