Workflow for setting up your contact form by EC2(AWS) and bootstrap


I would like to show you how to setup your AWS to transfer email through EC2.

How to setup to transfer emails through EC2

I was very stucked on installing additional components for mail transfer because of much strict regulation of AWS.

What I need to achieve:

  • Use bootstrap contact form “”
  • Receive clients emails by my gmail account.
  • All my websites files are hosted on AWS.
  • Use SMTP access with PHP (Bootstrap agency’s contact template needs SMTP access with PHP)

Setup steps

  1. Design your files of  templates on your local PC, including contact form part.
  2. Set up your instances on AWS console.
    NOTE:Do not upload on S2! You must use EC2 for your saving files. Because S2 does not support any SMTP email transfer.
  3. Upload all files into your created server.
  4. Setup AWS sending/receiving email.
  5. Verify your email address with Amazon SES.
  6. Get your SMTP credentials.
  7. Install PHP.
    NOTE:Amazon’s trouble shooting page mentioning downloading complete files from for PHP installing.
    But in my case that it did not work. I think that is because of PHP version.
    I suggest yum install to install following by another Amazon tutorial.

    [ec2-user ~]$sudo yum install -y httpd24 php70 mysql56-server php70-mysqlnd
  8. Install the Composer dependency manager.
    • Run following command to get composer from its original site.
    [ec2-user@localhost ~]$ curl -sS | php

    Composer setting file “composer.phar” has also been created in”/home/ec2-user/composer.phar”.

    • Run following command to get moved “composer.phar” file.
    [ec2-user@localhost ~]$ sudo mv composer.phar /usr/local/bin/composer
    • Run following command to know where actual composer files are in.
      [ec2-user@localhost ~]$ which composer

      You will see “composer” has been installed in “/usr/local/bin/”.

  9. Install the PHPMailer package.
[ec2-user@localhost ~]$ composer require phpmailer/phpmailer

Now setting has been done.

If it does not work, Amazon tutorials mentions sample test program on the site.

require 'path_to_sdk_inclusion';

That part can be following. It should point to “vendor” folder that all composer setting .php files are in.

require 'vendor/autoload.php';

AWS has lots restrictions

I hope you have been done.

After one year later, I decided to leave from using AWS anymore because of its too much strict restrictions.