Free To Use Smtp Server
Mailgun is one of the best SMTP servers that allows you to send multiple emails with a safe routing so that no one uses your domain in order to send spam. It has enhanced features in order to reduce bounce rates and spam reports.
Use Case ScenarioLet’s say there are two servers: server A and server B. You have on server A with Postfix as the SMTP server. You can use it to send emails directly to recipients, because port 25 isn’t blocked.Later you use server B to set up a website, which needs to send notification emails to users. You can set up another mail server on server B, but it’s a waste of time and hardware resources.
How To Use Free Smtp Server
A more sensible solution is to install Postfix SMTP server on server B and configure it to send emails via server A, which can relay emails from server B to the final recipients. Server A has built up its IP reputation, so you don’t have to build IP reputation for server B.If you run WordPress on your own Linux server, I recommend you follow this tutorial to set up Postfix SMTP relay. This way, you can get rid of SMTP plugins in WordPress. WordPress plugins slow down your site and they can be vulnerable, such as, which allows unauthorized users to modify WordPress options and execute malicious code.
My site has been compromised once, because of vulnerability in WordPress plugin. So I get rid of as many plugins as I can, when I can implement the same function with the underlying operating system.Without further ado, let’s get started. Installing Postfix SMTP Server on Server BFirst, let’s install Postfix SMTP server on server B with the following command. If Postfix is already running on server B, then skip installing Postfix, but you still need to install the libsasl2-modules package. Sudo apt install postfix libsasl2-modulesWhen you see the following message, press Enter to choose the second option: Internet Site.Next, set the system mail name. For example, I enter my domain name www.linuxbabe.com. Note that you should not enter your main domain name like linuxbabe.com, because that will make server B as a destination for your main domain name, which means emails generated from server B for will be sent to server B itself, instead of server A.Once Postfix SMTP server is installed on server B, let’s configure SMTP relay.
Postfix SMTP Relay via port 587Edit the Postfix main configuration file on server B. Sudo nano /etc/postfix/main.cfFind the following line. Relayhost =By default, its value is not set. You need to set the hostname of server A (your mail server) as the relay host like below. Relayhost = mail.linuxbabe.com:587Then add the following lines to the end of this file to configure SASL authentication. We specify that the /etc/postfix/saslpassword file contains the username and password.
# outbound relay configurationssmtpsaslauthenable = yessmtpsaslpasswordmaps = hash:/etc/postfix/saslpasswdsmtpsaslsecurityoptions = noanonymoussmtptlssecuritylevel = mayheadersizelimit = 4096000Save and close the file. Next, you should create a dedicated email account on your mail server, so server B can use this email account to login via port 587.
After that, create the /etc/postfix/saslpasswd file. Sudo nano /etc/postfix/saslpasswdAdd the SMTP relay host and SMTP credentials to this file like below. Replace these values with the hostname of your own mail server, the email account and password. Notice that there’s a colon between the email account and password. Mail.linuxbabe.com:587:passwordSave and close the file.
Then create the corresponding hash db file with postmap. Sudo postmap /etc/postfix/saslpasswdNow you should have a file /etc/postfix/saslpasswd.db. Restart Postfix for the changes to take effect. Sudo systemctl restart postfixBy default, saslpasswd and saslpasswd.db file can be read by any user on the server.
Change the permission to 600 so only root can read and write to these two files. Sudo chmod 0600 /etc/postfix/saslpasswd /etc/postfix/saslpasswd.dbFrom now on, Websites on server B can use Postfix to send emails, which will be relayed through your mail server.
Note that many web applications provides two email-sending modes:. SMTP. SendmailSMTP usually refers to the SMTP relay function in the web application itself and sendmail refers to using the SMTP server on the underlying operating system. You need to choose the sendmail option in order to use Postfix SMTP relay. If you installed SMTP plugin on your WordPress site, remove the SMTP plugin and WordPress will use Postfix SMTP relay.
If You Have iRedMail on Server AIf you used iRedMail to set up mail server on server A, then the iRedAPD policy daemon will likely to reject email relay from server B, because the sender is not same as SMTP authenticate username. To solve this problem, we need to add the SMTP authentication username to the allowed list.Edit the iRedAPD configuration file. Sudo nano /opt/iredapd/settings.pyAdd the following line at the end of the file. Replace the red text as necessary. ALLOWEDLOGINMISMATCHSENDERS = ' 'Save and close the file. Then restart iRedAPD for the change to take effect.
Sudo systemctl restart iredpad Preventing Spammers on Server BBy default, Postfix SMTP server listens on all active interfaces on the machine. Since the Postfix SMTP server on server B is only used for sending transactional emails to users, we can make it listens on localhost only, so bad actors can’t send spam to it.Edit the Postfix main configuration file on server B. Sudo nano /etc/postfix/main.cfFind the following line. Inetinterfaces = allChange it to: inetinterfaces = loopback-onlySave and close the file. Restart Postfix for the change to take effect.
Sudo systemctl restart postfix Setting the From Address, From Name and Return-PathBy default, the From address and From name are the same as the email account that is used to authenticate login, and the return-path will be something like. You can set custom From address, From name and Return-Path in your web application.Let’s use WordPress as an example.
You can add the following lines in your WordPress theme’s functions.php file to override the default From address, From name and return-path. Replace the red text as necessary. You should create the From email address on your mail server to prevent send failure.
Domain2.com:passwordSave and close the file. Then create the hash db file. Sudo postmap /etc/postfix/relaybysendersudo postmap /etc/postfix/saslpasswdRestart Postfix SMTP server for the changes to take effect. Sudo systemctl restart postfixFrom here on out, emails with domain1.com in the Envelope From address will be relayed via mail.domain1.com and emails with domain2.com in the Envelope From address will be relayed via mail.domain2.com. Emails with other domains names in the Envelope From address will be relayed via the host specified for relayhost parameter.Mail.domain1.com and mail.domain2.com can point to the same IP address, which means the two domain names are using the same mail server.
You may have noticed it when we manually placed files into the game folder. Skyrim mod list 2019.
You can check one of the following tutorials to host multiple domains on a single mail server.You can also host emails on different servers for the two domain names. If you have multiple WordPress sites on server B, you should also change each functions.php file in your WordPress themes to set custom From address and names for each domain name. Removing Sensitive Information from Email HeadersBy default, Postfix SMTP server will add a Received: email header, recording the IP address of server B, which can leak the IP address of your website (If it’s behind CDN). You can tell Postfix to ignore it.
Create a header check file on server A. Sudo nano /etc/postfix/headerchecksPut the following lines into the file. /^Received:/ IGNORESave and close the file.
Then edit the Postfix main configuration file. Sudo nano /etc/postfix/main.cfAdd the following two lines at the end of the file.
Headerchecks = regexp:/etc/postfix/headerchecksSave and close the file. Then run the following command to rebuild hash table. Sudo postmap /etc/postfix/headerchecksReload Postfix for the change to take effect. Sudo systemctl reload postfixNow Postfix won’t include those sensitive information in email headers. Note that some folks may also like removing the MIME-Version header. I don’t recommend it, because this will cause DKIM verification failure.
ConclusionI hope this tutorial helped you set up SMTP relay between 2 Postfix SMTP servers. As always, if you found this post useful, then to get more tips and tricks. Take care 🙂.
Google’s SMTP server is a free service that you can use to send emails from your custom domain, website, or web application. SMTP stands for Simple Mail Transfer Protocol. Basically, it’s an internet protocol for email transmission between servers. These days most emails are sent from an SMTP server. Anyone with a Gmail or Google Apps account can use, albeit it does have a daily sending limit.In this article, we’ll have a look at how you can set up Google’s free SMTP server to send emails from a custom domain, a WordPress site, and a PHP server.
Why Use Google’s SMTP Server?Having access to an external SMTP server has a couple of benefits. (and sometimes ISPs, too) offer SMTP support, however this is not always the case. Even if you can send emails from your hosting account, you may bump into deliverability issues. For instance, emails sent from Google’s servers are less likely to be labeled as.Besides, you have a secure (and searchable!) backup of your emails on Google’s servers.
And, if you have more than one accounts you can manage all your emails from the same place, too. It can also be a godsend if you want to send emails from within your website or web application. WordPress even has plugins such as or for this purpose.Some professional services such as newsletters, ebook download forms, and certain LinkedIn services also require users to have a custom email address. Meaning, they don’t accept email addresses ending in yahoo.com, gmail.com, etc. Having a custom email address enables you to access these services, too. Sending LimitAs I mentioned before, Google’s free service does have a daily —it is 100 emails per day. After you reach the limit, you won’t be able to send more emails for the next 24 hours.
Most likely, this amount won’t be enough for a bigger company. However 3,000 free emails per month is still an excellent option for many smaller players. Google’s SMTP Server SettingsYou need to use the following settings to set up your custom domain, website, or web application with Google’s free SMTP server:Outgoing Mail (SMTP) Server: smtp.gmail.comUse Authentication: YesUse Secure Connection: Yes (TLS or SSL depending on your mail client or website plugin)Username: your Gmail or Google Apps email address (e.g. User@gmail.com or user@example.com)Password: your Gmail or Google Apps passwordPort: 465 (for SSL) or 587 (for TLS)setting up an App password for the account as well to make sure that the authentication works fine. Here are the if you don’t have one yet. Before generating an App password, you need to for your Google account, too. You can use your App password instead of your Gmail password to log into your account.1. Send Emails from a Custom DomainTo send emails from a custom domain, for instance, from an email address such as user@example.com, you need to be the owner (or manager) of that domain.Log in to your account at your domain registrar and look for the email forwarding settings (different DNS providers might use different menu labels, but usually, it’s just called “Email forwarding”).
When you find them, set up an email forwarder that forwards emails from your custom domain to your Gmail account. For example, from user@example.com to user@gmail.com. This way, you will receive all incoming mails within your Gmail account.Now, you need to set up your Gmail account to send outgoing mails using the custom domain. So, you will create the email inside your Gmail mailbox, but it will be sent from the custom email address.
Go to your Gmail settings page by clicking the little gear icon in the top right corner of your mailbox and select the Settings dropdown menu. Then, navigate to the Accounts and Import tab:Inside the Send mail as setting, find the Add another email address option. When you click it, a popup like below will appear on the screen.
Insert the details of the custom email address into the input fields:On the next page, you need to configure your SMTP server details. You simply add the SMTP detailed mentioned above in the article.
Your username is your Gmail email address and your password is your Google App password (not the Gmail password).After you add the alternative email address, Google sends you a confirmation code by email. Click the link or enter the verification code manually & you are done. Don’t forget that from now on, you need to sign in to your account with your App password. Other Adjustments of Your Gmail SettingsThese were the basic steps, however, if you want your custom email work perfectly with Google’s SMTP server, there are two other things you need to do.First, if you want a copy of your outgoing emails inside your Gmail account’s Sent folder, you need to enable IMAP. IMAP stands for Internet Message Access Protocol.
Email clients use this protocol to retrieve messages from a mail server.On your Gmail settings page, find the Forwarding and POP/IMAP tab and navigate to the IMAP Access option. Here, choose the Enable IMAP option and hit the Save Changes button.Secondly, Google’s SMTP server automatically rewrites the From line of the email you send to the default email account. This can affect how your recipients perceive your brand and can meddle with the Reply-to settings of some email clients, so you might want to change it.To do so, go to the Accounts and Import tab on your Gmail settings page and find the Send mail as option. Here, mark your custom email address as default:From now on, your custom email address will appear in the From line inside your recipients’ email clients by default. Send Emails from Your WordPress SiteWordPress allows you to send emails from their WordPress site.
However, many website owners experience deliverability issues with the default wpmail function. For them, using an external SMTP server that sends the emails properly can be a lifesaver.You can find a couple of in the official WordPress repo. Here, I’ll show how you can use the plugin to configure your WordPress site with Google’s SMTP server.First, install and activate the plugin inside your WordPress admin area from the Plugins Add New menu. Then, navigate to the plugin’s settings page by clicking the Settings WP Mail SMTP menu.The plugin has separate settings for Gmail’s SMTP server, so the configuration is quite straightforward. You only need to insert the login details of your Gmail or Google Apps account and that’s all.
You can test the setup by sending a test email to yourself.3. Send Emails with PHPMailerYou can also use Google’s SMTP server to send emails from a PHP server. You can find many popular email sending libraries for PHP. Here, I’ll show you how to use one of the most popular ones called. You can install PHPMailer on your server via Composer or manually (see the in the docs).To configure PHPMailer, you need to edit the gmail.phps file you can find. The stands for PHP Source and it’s generally used to store PHP code that can be opened in the web browser for educational or informational purposes.
As the contents of a PHP source file can be viewed by anyone just like a regular text file, make sure that you don’t leave any passwords or sensitive data in this file.Inside the gmail.phps file, you need to define the values of the Username, Password, setFrom, addReplyTo, addAddress, Subject, msgHTML, AltBody, and addAttachment properties. After you added your details, you need to rename the file from gmail.phps to gmail.php so that your web server can interpret it.Then, run the script inside your browser. If the email was sent successfully you will see a success message. If something went wrong you can find how to solve the issue on PHPMailer’s (some issues are surprisingly common).
Next StepsWith Google’s SMTP server you can send emails for free from a custom domain, website, or web application. Although the free service has a sending limit, it’s an excellent solution if you don’t want to send a huge amount of emails.If you want to learn more about the business side of email marketing as well, don’t miss our article on the. And, we have a great collection of the, too.