How to Configure PowerMTA: SMTP Users

Newbie friendly guide to configure PowerMTA SMTP users for remote & local feeding

PowerMTA SMTP Users section is used to create SMTP user credentials for your PowerMTA installation. There’s no limit on the number of SMTP users you can create. Part 2 of the How to Configure PowerMTA series is going to show you how to create new PowerMTA SMTP users.

Configure PowerMTA SMTP User

We’ve configured PowerMTA General Options in the previous tutorial. SMTP users’ section of the PowerMTA configuration file is comparably smaller than General Options section. it already contains a code snippet for a sample user which looks like below,

				
					<smtp-user contact>
password vip1caa6e9fac9c
source {pmta-auth1} 
</smtp-user>

<source {pmta-auth1}>
    smtp-service yes
    always-allow-relaying yes
    require-auth true
    process-x-virtual-mta yes
    default-virtual-mta pmta-pool1
    remove-received-headers true
    add-received-header false
    hide-message-source true
	process-x-job yes
    remove-header X-PreviewEmail,X-Mailer,X-Mailer-RecptId,X-Mailer-Sent-By,X-Priority
</source>
				
			

The first line of the above snippet creates an SMTP user with username contact. The line reads,

				
					<smtp-user contact>
				
			

You need to change contact with your own choice of a username. We’ll use vpsfix for this tutorial. The second line of the code specifies a password for the user. You need to change that too. We’ll be using 1234vpsfix as an example. That’s all you need to change in this section if you only need one SMTP user. Our modified snippet looks like this.

				
					############################################################################
# BEGIN: SMTP USERS
############################################################################

<smtp-user vpsfix>
password 1234vpsfix
source {pmta-auth1} 
</smtp-user>

<source {pmta-auth1}>
    smtp-service yes
    always-allow-relaying yes
    require-auth true
    process-x-virtual-mta yes
    default-virtual-mta pmta-pool1
    remove-received-headers true
    add-received-header false
    hide-message-source true
	process-x-job yes
    remove-header X-PreviewEmail,X-Mailer,X-Mailer-RecptId,X-Mailer-Sent-By,X-Priority
</source>

############################################################################
# END: SMTP USERS
############################################################################
				
			

We’ll look into adding a second SMTP user in the next section of this tutorial. You can skip that and go to part 3: Virtual MTA if you don’t need multiple SMTP users.

Configure Multiple PowerMTA SMTP Users

Adding additional SMTP users to your PowerMTA server is as easy as it can get. You just need to duplicate the sample snippet from earlier and change the username. We’ll add a new SMTP-user with username vpsfix1 and password 1234vpsfix1. The code will look like this,

				
					<smtp-user vpsfix1>
password 1234vpsfix1
source {pmta-auth1} 
</smtp-user>
				
			

Now we have 2 SMTP users vpsfix and vpsfix1 configured on our PowerMTA server. These users will be using the same set of IP addresses to send out emails. The modified PowerMTA SMTP user section will look like this,

				
					############################################################################
# BEGIN: SMTP USERS
############################################################################

<smtp-user vpsfix>
password 1234vpsfix
source {pmta-auth1} 
</smtp-user>

<smtp-user vpsfix1>
password 1234vpsfix1
source {pmta-auth1} 
</smtp-user>

<source {pmta-auth1}>
    smtp-service yes
    always-allow-relaying yes
    require-auth true
    process-x-virtual-mta yes
    default-virtual-mta pmta-pool1
    remove-received-headers true
    add-received-header false
    hide-message-source true
	process-x-job yes
    remove-header X-PreviewEmail,X-Mailer,X-Mailer-RecptId,X-Mailer-Sent-By,X-Priority
</source>

############################################################################
# END: SMTP USERS
############################################################################
				
			

While that’s all you need to have multiple SMTP users on your PMTA server, more advanced configuration is certainly possible. We’ll look into a scenario where you need each SMTP user to have their own set of dedicated IPs.

PowerMTA SMTP users with Individual VirtualMTA Pools

The above SMTP user configuration uses a single Virtual MTA Pool (pmta-pool1) defined by {pmta-auth1} across two smtp user accounts. Meaning both accounts will be sharing a single IP address or set of IP addresses. A PMTA pool can be a single VirtualMTA or set of VirtualMTAs defined in the configuration file. We’ll cover PowerMTA VirtualMTAs in the 3rd tutorial and VirtualMTA pools in the 4th tutorial of this series.

If you want to use dedicated IP addresses for each SMTP user, you can configure it using source. If you look at the SMTP user configuration we added earlier, both users have source {pmta-auth1} on their configuration. And settings for {pmta-auth1} is defined a bit later which uses pmta-pool1 defined by the value of default-virtual-mta.

So, to have dedicated IPs for each SMTP user, you need to have dedicated VirtualMTA pools defined for each SMTP user. Let’s take vpsfix1 and give them a dedicated VirtualMTA pool like this,

				
					<smtp-user vpsfix1>
password 1234vpsfix1
source {pmta-auth2} 
</smtp-user>
				
			

If you look closely, you’ll notice that we’ve changed line 3 on the above snippet and changed {pmta-auth1} to {pmta-auth2}. So, after this change user vpsfix is using {pmta-auth1} and vpsfix1 is using {pmta-auth2}. 

Next, we’ll configure {pmta-auth2}. Copy the following snippet and paste it after source {pmta-auth1} section.

				
					<source {pmta-auth2}>
    smtp-service yes
    always-allow-relaying yes
    require-auth true
    process-x-virtual-mta yes
    default-virtual-mta pmta-pool2
    remove-received-headers true
    add-received-header false
    hide-message-source true
	process-x-job yes
    remove-header X-PreviewEmail,X-Mailer,X-Mailer-RecptId,X-Mailer-Sent-By,X-Priority
</source>
				
			

Line 6 of above snippet configures {pmta-auth2} to use pmta-pool2 which we will be adding on part 4 of this tutorial. The SMTP Users section of the PowerMTA configuration file should look like below after the changes,

				
					############################################################################
# BEGIN: SMTP USERS
############################################################################

<smtp-user vpsfix>
password 1234vpsfix
source {pmta-auth1} 
</smtp-user>

<smtp-user vpsfix1>
password 1234vpsfix1
source {pmta-auth2} 
</smtp-user>

<source {pmta-auth1}>
    smtp-service yes
    always-allow-relaying yes
    require-auth true
    process-x-virtual-mta yes
    default-virtual-mta pmta-pool1
    remove-received-headers true
    add-received-header false
    hide-message-source true
	process-x-job yes
    remove-header X-PreviewEmail,X-Mailer,X-Mailer-RecptId,X-Mailer-Sent-By,X-Priority
</source>

<source {pmta-auth2}>
    smtp-service yes
    always-allow-relaying yes
    require-auth true
    process-x-virtual-mta yes
    default-virtual-mta pmta-pool2
    remove-received-headers true
    add-received-header false
    hide-message-source true
	process-x-job yes
    remove-header X-PreviewEmail,X-Mailer,X-Mailer-RecptId,X-Mailer-Sent-By,X-Priority
</source>

############################################################################
# END: SMTP USERS
############################################################################
				
			

That should do it. Please don’t use the sample usernames and passwords mentioned in this tutorial. We’ll look into PowerMTA VirtualMTAs and IP rotation in the next tutorial.

Tharindu

Hey!! I'm Tharindu. I'm from Sri Lanka. I'm a part time freelancer and this is my blog where I write about everything I think might be useful to readers. If you read a tutorial here and want to hire me, contact me here.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button