How to use MailChannels as a Smarthost

Introduction:

It is very frequent for data centers to restrict emails from sending over port 25. Mailchannel is another Smarthost provider that helps mail to be sent over an alternative port using Exim.

Procedure

To use MailChannels, you are required to configure Exim to authenticate with MailChannels using the credentials given to you.

MailChannels comes with a plugin that helps with quick configuration options. For details, please check their official documents at:

MailChannels cPanel & WHM plugin for Outbound Filtering

MailChannels cPanel & WHM Plugin for Inbound Filtering

  1. Sign up for MailChannels
  2. You have to log in to WHM, and move to “WHM / Service Configuration / Exim Configuration Manager / Advanced Editor”. Here, search for “Section: AUTH”. In the text box, input the following.
  3. In the Section: Auth area, add:
  • mailchannels_login:driver = plaintext public_name = LOGIN client_send = : MailChannelsUsername : MailChannelsPassword

  • Restore MailChannelsUsername and MailChannelsPassowrd with the username and password offered by MailChannels.4. Next, go to the “Section: POSTMAILCOUNT” section, input the following.
  • On v108 or above:
  • send_via_mailchannels:driver = manualroute  domains = ! +local_domains : ! +manualmx_domains.ifdef SRSENABLED # if outbound, and forwarding has been done, use an alternate transport transport = ${if eq {$local_part@$domain} \          {$original_local_part@$original_domain} \          {mailchannels_smtp} {mailchannels_forwarded_smtp}}.else transport = mailchannels_smtp.endifroute_list = * smtp.mailchannels.net::25 randomize byname

  • On v106 or below

send_via_mailchannels:
driver = manualroute
transport = mailchannels_smtp
domains = ! +local_domains : ! +manualmx_domains
route_list = * smtp.mailchannels.net::25 randomize byname

5. Click on the “Section: TRANSPORTSTART” section. Input the following into the text box:

mailchannels_smtp:
driver = smtp
hosts_require_auth = *
tls_tempfail_tryclear = true
headers_add = X-AuthUser: ${if match {$authenticated_id}{.*@.*}\
{$authenticated_id} {${if match {$authenticated_id}{.+}\
{$authenticated_id@$primary_hostname}{$authenticated_id}}}}
dkim_domain = ${perl{get_dkim_domain}}
dkim_selector = default
dkim_canon = relaxed
dkim_private_key = “/var/cpanel/domain_keys/private/${dkim_domain}”
message_linelength_limit = 2048

6. Moreover, on servers running v108 or above, add the following to the TRANSPORTSTART section as well:

.ifdef SRSENABLED
mailchannels_forwarded_smtp:
driver = smtp
hosts_require_auth = *
max_rcpt = 1
return_path = ${srs_encode {SRS_SECRET} {$return_path} {$original_domain}}
tls_tempfail_tryclear = true
headers_add = X-AuthUser: ${if match {$authenticated_id}{.*@.*}\
{$authenticated_id} {${if match {$authenticated_id}{.+}\
{$authenticated_id@$primary_hostname}{$authenticated_id}}}}
dkim_domain = ${perl{get_dkim_domain}}
dkim_selector = default
dkim_canon = relaxed
dkim_private_key = “/var/cpanel/domain_keys/private/${dkim_domain}”
.endif

7. Go to the bottom of the page and click “Save”. The changes will be added to the Exim configuration and automatically restart with the Exim service.

8. You can send a test email using one of the Webmail applications. If the email doesn’t leave the server, you must examine the /var/log/exim_mainlog file to determine the cause of the issue.

headers_add = “X-MC-MailingList: $original_local_part@$original_domain\n”

Check the below example of how this will display in the configuration file:

mailman_virtual_transport:
driver = pipe
command = /usr/local/cpanel/3rdparty/mailman/mail/mailman \
‘${if def:local_part_suffix \
{${sg{$local_part_suffix}{-(\\w+)(\\+.*)?}{\$1}}} \
{post}}’ \
${lc:$local_part}_${lc:$domain}
current_directory = /usr/local/cpanel/3rdparty/mailman
home_directory = /usr/local/cpanel/3rdparty/mailman
user = mailman
group = mailman
headers_add = “X-MC-MailingList:$original_local_part@$original_domain\n”

Once everything is configured, click save.

Leave a Reply