Send With Confidence
Partner with the email service trusted by developers and marketers for time-savings, scalability, and delivery expertise.
Time to read: 3 minutes
Any errors outputted during this time may provide some insight into what’s not working. But, if you get a response that shows it has been installed, feel free to move on to the next section.
If it hasn’t been installed, check out the Postfix documentation or contact your host for installation instructions.
Postfix has a few requirements that must be met before emails will send correctly.
First, modify your local Postfix configuration. You can load an editor directly from your terminal by running the following command:
Once open, check to make sure that the following 4 variables are defined as follows:
And voila! Save the changes and restart Postfix using `sudo postfix reload`.
We’ve found that the most important of these variables is `myhostname`. If you don’t define this variable, your local environment is unable to assign a default location to send the email from. Use a real domain or something arbitrary (like in the example above) to fulfill this value.
To test that Postfix is working and subsequently PHP `mail()`, we’ll create a simple script to run. In your favorite text editor or integrated development environment (IDE), create a file called `mail.php` and include the following code:
Be sure to replace the `$to` variable with your actual email address. In your terminal, run the program using the following command and check your email:
Partner with the email service trusted by developers and marketers for time-savings, scalability, and delivery expertise.