I would like to show you how to setup your AWS to transfer email through EC2.
Contents
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 “http://startbootstrap.com/template-overviews/agency/”
- 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
- Design your files of templates on your local PC, including contact form part.
- 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. - Upload all files into your created server.
- Setup AWS sending/receiving email.
- Verify your email address with Amazon SES.
- Get your SMTP credentials.
- Install PHP.
NOTE:Amazon’s trouble shooting page mentioning downloading complete files from http://php.net/downloads.php 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
- Install the Composer dependency manager.
- Run following command to get composer from its original site.
[ec2-user@localhost ~]$ curl -sS http://getcomposer.org/installer | 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/”.
- 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.