Report this

What is the reason for this report?

How can i send mail to same domain with SwiftMail?

Posted on August 24, 2017

Hi, i’ve followed many tutorials and workarounds here in DO trying to resolve my issue. I just can’t get to send e-mail to an address of the same domain of my droplet.

My application use swiftmail to send messages, when i use any email address outside tenvisu.com.br it works fine. But it just wont send to any account of tenvisu.com.br which is pointing to another server to use webmail

Here’s the Postfix Config File:

smtpd_use_tls=yes
smtpd_tls_auth_only = yes
#smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
#smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions =
        permit_sasl_authenticated,
        permit_mynetworks,
        reject_unauth_destination
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
#myhostname = LAMP68d2a3jkns201610196abafa
myhostname = tenvisu.com.br
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
#mydestination = $myhostname, localhot.$mydomain, $mydomain
mydestination = localhost, tenvisu.com.br, mail.tenvisu.com.br, localhost.tenvisu.com.br
#mydestination = localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
myorigin = /etc/mailname

virtual_transport = lmtp:unix:private/dovecot-lmtp
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf

milter_protocol = 2
milter_default_action = accept

smtpd_milters = inet:localhost:12301
non_smtpd_milters = inet:localhost:12301

I have also configured SPF and DKIM using DO’s tutorials.

I’m using an external mail server to deal with webmail accounts. These are the records at my droplet’s “Networking” section:

Type Hostname Value TTL (seconds)
CNAME webmail.tenvisu.com.br is an alias of webmail-vip.kinghost.net. 43200
MX tenvisu.com.br mail handled by mx-vip-02-farm64.kinghost.net. 14400
A tencom.tenvisu.com.br directs to 159.203.170.68 3600
MX tenvisu.com.br mail handled by mx-vip-01-farm64.kinghost.net. 14400
CNAME www.tenvisu.com.br is an alias of tenvisu.com.br. 43200
TXT tenvisu.com.br returns “v=spf1 ip4:159.203.170.68 ~all” 1800

Can you guys help me out? Right now my application has to send to an outsider account but for business reasons it has to send to the same domain.

Thanks in advance!



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello there,

I would like to update this question.

If the issue is only with the local mail delivery then double-check that the mydestination setting in your postfix config contains the correct domain names and that the DNS for the domain names is pointing to the correct server.

You can also use a third party like SendGrid to deliver your outgoing emails.

I’ll highly recommend checking this article

https://www.digitalocean.com/community/tutorials/why-you-may-not-want-to-run-your-own-mail-server

Hope that this helps!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.