I want to configure localhost to send emails via postfix server, I do this for testing my solution of setup Docker with Wordpress (with solution found on internet email was not working, also curl but that was because of corporate CA SSL certs). Right now I'm testing this on Fedora and try to send to my two account at onet.pl and jcubic.pl domains they both rejected my emails.
Here are the postfix logs:
Apr 4 13:24:14 23c96150d42f postfix/smtp[134]: BCAA01659A0: to=<blog@jcubic.pl>, relay=mail.jcubic.pl[185.255.40.21]:25, delay=0.25, delays=0/0/0.07/0.17, dsn=5.7.1, status=bounced (host mail.jcubic.pl[185.255.40.21] said: 550 5.7.1 <blog@jcubic.pl>: Recipient address rejected: Please see http://www.openspf.net/Why?s=helo;id=jcubic.pl;ip=185.129.113.210;r=unknown (in reply to RCPT TO command))
Apr 4 13:24:14 23c96150d42f postfix/qmgr[95]: BCAA01659A0: removed
Apr 4 13:25:41 23c96150d42f postfix/smtp[134]: 2D02E1659A0: to=<jcubic@onet.pl>, relay=mx.poczta.onet.pl[213.180.147.146]:25, delay=0.85, delays=0/0/0.85/0, dsn=4.7.1, status=deferred (host mx.poczta.onet.pl[213.180.147.146] refused to talk to me: 220-mx.poczta.onet.pl ESMTP 450 4.7.1 Client host rejected: cannot find your reverse hostname, [185.129.113.210])
First is SPF protection, I can ignore that and only deal with onet.pl that show error about reverse hostname, I've read that I need to have proper DNS records at jcubic.pl. I can setup DNS on jcubic.pl, this just for now to see if email works, but I don't know how to and multiple A DNS records. I'm also not sure exactly how I can do that (how record should look like).
I was testing my docker-wordpress combo at work with Ubuntu on OpenStack and I was able to send email to gmail corporate account.
I'm using this setup, I have postfix instance as docker compose service with this config:
postfix:
image: catatnight/postfix
environment:
maildomain: example.com # at work here was valid domain of my company (gene.com)
smtp_user: postfix:postfixpass
ports:
- "25:25"
restart: always
port 25 probably will not be public it's just for testing, I wasn't sure if that was the problem of no sending emails:
and my wordpress image use msmtp
command to send emails, I'm testing right now this:
echo "Hello this is sending email using msmtp" | msmtp <name>@onet.pl
echo "Hello this is sending email using msmtp" | msmtp <name>@jcubic.pl
My msmtp config look like this:
# Set defaults.
defaults
# Enable or disable TLS/SSL encryption.
tls off
tls_starttls off
# Setup WP account's settings.
account postfix
host postfix
port 25
auth login
user postfix@jcubic.pl
password postfixpass
from blog@jcubic.pl
logfile /var/log/msmtp/msmtp.log
account default: postfix
I'm testing different user
nad from
, can I just configure DNS on jcubic.pl to verify that my local IP (that's dynamic) is valid just for now, so I can test if send email works? My domain jcubic.pl is on shared hosting, but I can add DNS records. Is possible to also fix SPF issue. How this will work on normal server. At work I use domain of my company but it was intranet IP address (instance of private OpenStack), I'm not sure why gmail thought that sender was valid.
I also have another question is postfix mail server need to be public and access on IP that sent the email? this is how it was working at work (there was public port from docker postfix container), but here I have localhost and also NAT router, my public IP is different and mail server is not accessed from internet. I'm not sure what DNS records my company have.