大网数据广告活动
服务器运维问答

SPF record in DNS sending via Gmail

· 52CE 我爱测

I have an old domain that I want to re-purposes for a new website which will send emails. I'm using Asp.Net Core, if that makes a difference (I do not think it does). I've written several apps that send email in .Net and I feel q…

问题原文

原帖链接 · John · CC BY-SA 4.0

I have an old domain that I want to re-purposes for a new website which will send emails. I'm using Asp.Net Core, if that makes a difference (I do not think it does). I've written several apps that send email in .Net and I feel quite confident my code is correct. I'm more confused about the DNS configuration, especially for the SPF records.

I'm hosting my DNS on Name.com. In the picture below, you can see the SPF record, which is

"v=spf1 include:_spf.google.com -all" 

However, I notice that some TXT records are quoted and some are not. So, I'm wondering if that makes a difference. A different question said that if the answer in the TXT record contains spaces, then it needs to be quoted. So I suspect that part is OK.

What I am struggling with is the actual format of this TXT record. You can see the MX record is

aspmx.l.google.com

I used to have an SPF record that included MX but since I only send via gmails servers (smtp.gmail.com) I took it out. However, the messages keep getting blocked.

To be specific, my website, which is hosted on Azure (but I don't think that makes a difference here), is sending via SMTP using smtp.gmail.com as the server address. When it sends to @gmail.com email address, the email gets blocked with my sending email address getting this message:

"Your message to, [email omitted] has been blocked. See technical details below for more information.

"The response was:

"550 5.7.26 This mail has been blocked because the sender is unauthenticated. Gmail requires all senders to authenticate with either SPF or DKIM. Authentication results: DKIM did not pass SPF [trulymail.com] with ip: [209.85.220.41] did not pass To mitigate this issue, please visit Gmail's authentication guide for instructions on setting up authentication"

When I send to non-gmail domains it works but for @gmail.com address, the messages get blocked.

It states this is a problem with the SPF record. However, from what I have read, my SPF record is setup correctly.

Is this an SPF problem?

If yes, can anyone tell me what the correct SPF record should be if anyone using my sending domain only sends through through either the gmail web interface or through smtp.gmail.com via a client / code?

社区高分解答

原帖链接 · Keith Langmead · CC BY-SA 4.0

Suspect the issue is the SPF record and those quotes.

If I do a DNS lookup for trulymail.com your SPF TXT record is being returned as :

trulymail.com   text =
        ""v=spf1 include:_spf.google.com -all""

so it's showing double quotes, and I'd suggest you need to remove those quotes in your DNS UI.

Edited to mention, if you do an SPF lookup online, for instance MX Toolbox it reports that you have no SPF record on that domain, which would also say to me that what you have setup currently isn't being seen as a valid SPF record.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2023-10-30)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。