# Email Setup ¶

## Introduction ¶

This guide will explain several things you should consider when setting up your email account, whether you use your hosting's SMTP server, an external provider such as Gmail, Yahoo Mail or Outlook (Hotmail), or even PHP mail() function.

> Note: @app refers to the application root directory.

## When does Easy Forms send an email? ¶

It´s very important to know when Easy Forms send an email, because it will let you verify the application's correct functioning.

There are 5 actions or events that cause sending an email:

1. When you received a Form Submission and your app need to send confirmations or notifications by email. This is the most common action why emails are sent, as each time a user makes use of your forms, it will be sending emails.
2. When a registered user goes to Forgot Password and asks you to send an email with the instructions to recover his password.
3. When a registered user accesses his account and change his email address. In this case, an email is sent to the new address to click on a confirmation link.
4. When a registered user requests a confirmation email.
5. When a user logs correctly (with a valid username and password), but his status is 'Inactive' (his email has not been confirmed); automatically will be sent an email confirmation.

## Site Emails ¶

Easy Forms allows you to set 3 types of emails, each with a different use:

1. Admin e-mail: Administrator's e-mail. Not used as the emails' sender. But, it can be used as notifications Reply-To (When a form is submitted).
2. Support e-mail: Default sender of emails relate with Easy Forms' registered users managing. For example, to reset the password or to confirm an email, Support e-mail will be the sender of these emails. Additionally, it can be used as notifications Reply-To (When a form is submitted).
3. No-reply e-mail: Default sender of sent emails when form's notification and/or confirmations are configured. Additionally, it can be used as notifications Reply-To (When a form is submitted).

> Note: You must keep in mind that when a notification is configured, you can select a Form's Email field as Reply-To, to enable the notifications' recipient to easily reply these emails.

## How to set up the email sending? ¶

The process to send emails depends on the setting you make. By default, we recommend the SMTP server configuration. However, if your hosting provider does not allow it, you can also send emails with the PHP mail() function.

### Send emails with the PHP mail() function ¶

To send emails with the PHP mail() function you must perform the following steps:

1. Open the file `@app/config/params.php`
2. Change the value of `App.Mailer.transport` to `php`
3. Save the file and upload it to your server.

Ready! With this change, the Mail Server values configured will no be taken into account. Instead, PHP will send emails through the mail you've set in your hosting.

### Set emails with a hosting provider ¶

When we talk about hosting providers, we must understand that there are a variety of services and each with different policies. So you need to start testing the configuration that offers you the best results.

For this example, we will make reference to Dreamhost, one of the most popular.

1. Go to Dreamhost's Control Panel and create an email associated with the domain that hosts Easy Forms. For example, if Easy Forms is hosted on the example.com domain, create three emails: admin@example.com, support@example.com and no-reply@example.com.
2. Go to Easy Forms
3. Click on your username and then Settings
4. Add the 3 emails in the proper fields.
5. Click Save

Ready! Easy Forms can now send e-mails using the PHP mail() function and the Dreamhost's mail server.

> Note: Both, the domain and username are for reference only, you might as well use a single e-mail in the three fields.

> Important! Keep in mind, set these fields is very important for the proper delivery of emails, particularly Support and Non-Reply.

## Setting up emails with a SMTP server ¶

As hosting providers, SMTP providers also have restrictions that can affect the normal operation of Easy Forms. For example, Yahoo Mail requests that the sender of all emails must be the yahoo user. Gmail is less restrictive in this regard. However, you can use any of these services considering the following:

1. By default, all emails are sent with the SMTP server Username as sender. But we recomend that both Support e-mail and No-reply e-mail match your SMTP server Username .
2. Be careful when typing your password. By default, we hide it. But this is usually the most common reason why emails aren't sent.
3. Be patient. Some suppliers will take several minutes to delivery the mail. In our tests, Gmail and Outlook were faster.
4. Verify that the SMTP provider has not restricted access from your server. This can happen if for example, you always access your Hotmail account from country X and your hosting is in country Y.

The steps of the SMTP server settings are detailed in the documentation about installing Easy Forms.

## SMTP servers configuration data ¶

To find out Email Server Settings in cPanel, perform the following steps:

1. Go to your cPanel
2. Find the Mail section and Click Email Accounts
3. From the list of email accounts locate the email account you require the server settings for.
4. Click More followed by Configure Email Client.
5. You must use the information under the heading Manual Settings (Non-SSL Settings)

On the other hand, we have checked the correct operation of Easy Forms with the configuration of the following SMTP servers:

    Gmail
    - Host: smtp.gmail.com
    - Port: 587
    - Encryption: TLS

> Note: Please keep in mind that when using any free email account like Gmail, Yahoo Mail or Hotmail, there are limits that apply on the number of emails you are allowed to send daily. Outlook (Hotmail)

    - Host: smtp-mail.outlook.com
    - Port: 587
    - Encryptation: TLS

> Note: We recommend test the email sending and access your inbox in Outlook, to verify that Easy Forms access has not been restricted (You can accessed directly to: https://account.live.com/activity)

    Yahoo Mail
    - Host: smtp.mail.yahoo.com
    - Port: 465
    - Encryptation: ssl

> Note: According to our tests the Yahoo Mail delivery is successful, but it can take several minutes.