How can i send mail to same domain with SwiftMail?

August 24, 2017 375 views
Email Ubuntu 16.04

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 it works fine. But it just wont send to any account of which is pointing to another server to use webmail

Here's the Postfix Config File:

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 =
# 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 =
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
#mydestination = $myhostname, localhot.$mydomain, $mydomain
mydestination = localhost,,,
#mydestination = localhost
relayhost =
mynetworks = [::ffff:]/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/
virtual_mailbox_maps = mysql:/etc/postfix/
virtual_alias_maps = mysql:/etc/postfix/

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 is an alias of 43200
MX mail handled by 14400
A directs to 3600
MX mail handled by 14400
CNAME is an alias of 43200
TXT returns "v=spf1 ip4: ~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!

Be the first one to answer this question.