In its default state, it looks like this: The /etc/aliases file contains a list of alternate names for email recipients. In this step, you’ll set up email forwarding for user root, so that system-generated messages sent to it on your server get forwarded to an external email address. In the next step, you’ll set up email forwarding for root. You have now sent an email from your server and verified that it’s successfully received. Note that with this configuration, the address in the From field for the test emails you send will be in the form of your_domain, where your_user_name is the username of the server user you ran the command as. If you receive an error from the mail command, or you haven’t received a message after a prolonged period of time, check that the Postfix configuration you edited is valid and that your server’s name and hostname are set to your domain. You’ll set up encryption later, in step 5. At this point, all emails you send are unencrypted, which makes service providers think it’s likely spam. If it’s not there, check your spam folder. You should see the message in your inbox. Now, check the email address to which you sent this message. Remember to replace your_email_address with a valid email address that you can access. You can change the body and the subject of the email to your liking. echo "This is the body of the email" | mail -s "This is the subject line" your_email_address.To send a test email, run the following command: In this step, you’ll test whether Postfix can send emails to an external email account using the mail command, which is part of the mailutils package that you installed in the first step. You’ll now test it by sending an example message to an email address. You’ve configured Postfix to only send emails from your server. Then, restart Postfix by running the following command: When you are done, save and close the file. The optional masquerade_domains setting specifies the domain for which the subdomain will be stripped off in the email address. Open it for editing using nano or your favorite text editor: To make the changes, you’ll need to edit the main Postfix configuration file called main.cf, stored under etc/postfix. In this step, you’ll configure Postfix to send and receive emails only from the server on which it is running-that is, from localhost.įor that to happen, you need to configure Postfix to listen only on the loopback interface, the virtual network interface that the server uses to communicate internally. You have now installed Postfix and are ready to start configuring it. When you’ve finished, press TAB, followed by ENTER. The System mail name must be the same as the name you assigned to your server when you were creating it. If it does not show up automatically, run the following command to start it:Īfter that, you’ll get another configuration prompt regarding the System mail name: If you only see the description text, press TAB to select OK, then ENTER. That’s the recommended option for your use case, so press TAB, and then ENTER. Near the end of the installation process, you will be presented with the Postfix configuration window: #SMTP RELAY CENTOS 7 INSTALL#Then, install Postfix by running the following command: The fastest way is to install the mailutils package, which bundles Postfix with a few supplementary programs that you’ll use to test sending email. Do note that some email providers may reject email coming from DigitalOcean (or other) IP ranges, at their own discretion. If it’s not correct, run the following command to set it:Īdditionally, your account must have port 25 enabled, which may not be the case for some accounts. The output should match the name you gave the Droplet when it was being created. You can verify the server’s hostname by typing hostname at the command prompt. Note: Your server’s hostname and your Droplet’s name must match your_domain, because DigitalOcean automatically sets PTR records for the Droplet’s IP address according to its name.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |