Although PHP can send emails through the `mail()` function, **it is not the recommended option**. Instead, we advise using **SMTP authentication** to guarantee more reliable delivery.

Using SMTP is almost as simple as `mail()`, but with the benefit of better deliverability and security. Setting it up only requires one extra step: entering the server details.

- In **PrestaShop**, the option is built in natively under: *Advanced Parameters > E-mail > Set my own SMTP parameters*.
- In **WordPress**, you can easily configure SMTP with the [WP Mail SMTP](https://wordpress.org/plugins/wp-mail-smtp/) plugin:

![WP Mail SMTP plugin configuration (1)](/api/help/media/50adbb5b-199e-4418-b2ad-ecb615e1ecdc)

![WP Mail SMTP plugin configuration (2)](/api/help/media/710c54e3-4f1e-4249-8070-10f940353c11)

This video explains the whole process for WordPress and WooCommerce (in Spanish):

::youtube{id=gl3oWhtCdIw}

:::tip
The server, username and port details you need are in the guide [Setting up your email client](../hosting/configurar-cliente-email).
:::

## Why do we recommend SMTP authentication?

SMTP authentication improves your delivery rate and reduces the chance of your emails being flagged as SPAM. Here is why:

**It verifies the sender's authenticity**

- Emails sent over SMTP include headers certifying that the sender is legitimate.
- For example, if you receive an email from `steve-jobs@apple.com`, you can be sure it really comes from that address.
- With `mail()`, on the other hand, anyone can forge the sender, which increases the chance of the email being treated as SPAM.

**More security**

- It does not expose the path of your PHP scripts.
- It uses an encrypted connection to protect the information.
- It reduces the risk of abuse and fraudulent sending.

**Compatibility with external services**

- It lets you integrate solutions such as Amazon SES, Gmail, SendGrid or Mailgun, among others.

**Better error handling**

- SMTP provides detailed response codes that make troubleshooting easier.
- It offers more flexibility for configuring headers and handling bulk sending.

## Conclusion

If you are after reliability, security and a better delivery rate, use **authenticated SMTP** with libraries such as PHPMailer or SwiftMailer instead of PHP's `mail()` function.
