Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Mail sent with curl fails DKIM
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Mail sent with curl fails DKIM

tjntjn Member
edited August 2022 in Help

Whilst testing a bash script I'm writing that sends notification emails via MXRoute SMTP using just curl, I noticed that DKIM is failing. I'm receiving the email with no issues, and SPF is passing.

"Regular" emails aren't failing.

The only thing I've noticed in the headers is:
X-ACL-Warn: Adding Message-ID header because it is missing!

Am I overlooking anything?

smtpBody="Testing email from script"

curl --url smtps://$smtpHost:$smtpPort --ssl-reqd \
--mail-from $fromAddress \
--mail-rcpt $toAddress \
--user $smtpUser:$smtpPass \
-H "Subject: $smtpSubject" \
-H "From: $fromName <$fromAddress>" -H "To: $toAddress" \
-F "=$smtpBody"

Comments

  • Try sending it with a random Message-ID. iirc message id is part of the DKIM signiture, and maybe the auto-generated message id is making a problem?

  • mailcheapmailcheap Member, Host Rep

    The Date header is required as per RFC 822 so that could be the problem. The format is specified in the RFC. Message-ID is an optional nice to have.

    Pavin.

    Thanked by 1ralf
  • gzzgzz Member

    Today I learned you can send emails with curl. :o

  • mailcheapmailcheap Member, Host Rep

    @gzz said:
    Today I learned you can send emails with curl. :o

    It can do a whole lot more :wink:

    curl is a tool to transfer data from or to a server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP).

    Source: man 1 curl

    Pavin.

    Thanked by 1equalz
  • tjntjn Member

    @sanvit said:
    Try sending it with a random Message-ID. iirc message id is part of the DKIM signiture, and maybe the auto-generated message id is making a problem?

    I tried adding a random message ID, but I don't think google liked that 😅

    I probably need to work on this a little more.

    @mailcheap said:
    The Date header is required as per RFC 822 so that could be the problem. The format is specified in the RFC. Message-ID is an optional nice to have.

    Pavin.

    I added the date and DKIM passed! thanks @mailcheap

    @gzz said:
    Today I learned you can send emails with curl. :o

    Pretty cool huh?

    Thanked by 2ralf gzz
Sign In or Register to comment.