Wednesday, December 18, 2019

Adding domain MX record and DNS in AWS Route53

First, set the NS record. Then, delete all other records from the vendor controll panel including the default MX (Domain provider CrazyDomains) records.

Secondly, add a MX record in AWS Route 53 with your Service providers default server neme, that is (MX, 10 mateswork.com), it will help you to receive emails in your Hosting service provider mailbox.
After these settings, make sure, if you can receive mails in your vendor's inbox.

To check the MX record of a domain (in windows):
nslookup -type=MX domain.com nsservername.com

Sending website contact form email using Laravel + AWS SES

Sending mail from a web contact form using the AWS SES. 
First, we need to install a composer package called aws/aws-sdk-php and follow its instructions.

on Custom settings from config/services.php
AWS_SES_REGION=ap-southeast-2

Example: 
MAIL_MAILER=ses
#MAIL_MAILER=smtp
#MAIL_HOST=smtp.mailtrap.io
#MAIL_PORT=2525
#MAIL_USERNAME=84ba092b676750b44681
#MAIL_PASSWORD=04477ca9c6767f44406f
#MAIL_ENCRYPTION=TLS
# Global settings
MAIL_FROM_ADDRESS=info@microtechna.com
MAIL_FROM_NAME="${APP_NAME}"
# Custom settings from config/services.php
AWS_SES_REGION=ap-southeast-2

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
#AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=


On the other side, we need to Create User for SMTP(it also a IAM user) from SES dashboard. Credentials for SMTP users are only available when creating the user. For your protection, you should never share your SMTP credentials with anyone.

For example,
ses-smtp-user.20***2-900
SMTP Username: AKI*******W
SMTP Password: BJT*********51M
Secondly, we need to create a IAM user with the AmazonSESFullAccess policy we may named it "arn:aws:iam::2****80:user/ses-smtp-user.website-form-email".

For example,
arn:aws:iam::25*****80:user/ses-smtp-user.website-form-email





Accesskey:
ID: A****************Z
Secret: hT*****bqQ***************BB3



You need to put the values in your .env file on laravel. also varify the sender/receiver email to work with the sandbox or apply for increase the SES email sending limit.

MAIL_DRIVER=ses
MAIL_HOST=email-smtp.ap-southeast-2.amazonaws.com
MAIL_PORT=465
MAIL_USERNAME=AKI*******W (SMTP Username)
MAIL_PASSWORD=BJT*********51M (SMTP Password)
MAIL_ENCRYPTION=TLS

SES_KEY=AKI*******W (SMTP Username)
SES_KEY_SECRET=BJT*********51M (SMTP Password)
SES_REGION=ap-southeast-2

AWS_ACCESS_KEY_ID=A******Z
AWS_SECRET_ACCESS_KEY=h*****BB3
AWS_DEFAULT_REGION=ap-southeast-2
AWS_BUCKET=


Normally:
We can set the env like for general web hosting provider.
backup code:
MAIL_DRIVER=smtp
MAIL_HOST=webcloud02.iad01.ds.network
MAIL_PORT=465
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=SSL






Good luck!