0

I am having trouble with failing to deliver mails with my setup.

Server 1 - example.com + Direct Admin IP: 111.111.111.111, default domain (provided by hosting company: vps11111.company.com

Server 2 - dev.example.com, IP: 222.222.222.222, default domain (provided by hosting company: vps222222.company2.com

A Jira instance runs on dev.example.com, I am sending an invitation email being logged in as my.email@gmail.com to target.email@onet.pl

SMTP error from remote mail server after RCPT TO:<target.email@onet.pl>:
host mx.poczta.onet.pl [213.180.147.146]: 554 5.7.1 <target.email@onet.pl>:
Recipient address rejected: Spf check: fail

Test

Return-path: <my.email@gmail.com> Received: from
dfault.return.serv2.dns ([222.222.222.222] helo=vps222222.company.com)
   by vps11111.company.com with esmtpa (Exim 4.82)    (envelope-from
   <my.email@gmail.com>)  id 1aILXy-00044d-K9     for
   target.email@onet.pl; Sun, 10 Jan 2016 20:21:02 +0100

I have set the TXT record on example.com Direct Admin of dev.example.com to: "v=spf1 a mx ip4:222.222.222.222 ~all"

A records for mail, smtp and pop are left to 111.111.111.111 (jira setup to use jira@example.com address).

A records for dev.example.com., ftp and www are set to 222.222.222.222.

I am confused about all this setup (my first time) and would appreciate any help.

Jenny D
  • 27,780
  • 21
  • 75
  • 114
  • Have you tried ending it from the domain name you own? You don't own gmail.com :) – Virgil Shelton Jan 10 '16 at 23:48
  • @VirgilShelton for some reasons jira uses the admin email address as reply-to field. I'll check with email in my domain, but this does not fix the problem. – Marcin Kunert Jan 11 '16 at 10:15
  • `Reply-To` should not matter. And `From` can only matter in case there is no `Sender` header. Most servers, however, only check `Envelope-From`. So If you set `Envelope-From` (and `Sender` for paranoid email servers), you can use `From` and `Reply-To` as you wish. – mihi Jan 11 '16 at 17:28

1 Answers1

1

The problem is that the email is sent with the envelope sender set to your gmail address. That means that the SPF record that is being checked is the record for gmail.com, not the one for your own domain.

You need to fix your setup so that you either use your own address as sender, or so that you send your emails through google's servers by logging in with your google account.

Jenny D
  • 27,780
  • 21
  • 75
  • 114