Sending mails to Gmail needs Message-ID

Share your advanced PureBasic knowledge/code with the community.
hoerbie
Enthusiast
Enthusiast
Posts: 119
Joined: Fri Dec 06, 2013 11:57 am
Location: DE/BY/MUC

Sending mails to Gmail needs Message-ID

Post by hoerbie »

Hi,

sending mails with PB always needs a bit of luck, but actually I could no longer send mails from my mailserver to Gmail, all mails were bounced by Gmail due to a missing "Message-ID", that PB not automatically generates and my mailserver doesn't insert. In RFC this is not totally mandatory, but it looks like Gmail wants it now since this July.

After looking in the headers of other mails, solution for me was:

Code: Select all

SetMailAttribute(#yourmailid, #PB_Mail_Custom, "Message-ID: <"+FormatDate("%yyyy%mm%dd%hh%ii%ss", Date())+"."+RSet(Str(Random(999999,0)), 6, "0")+"@"+yourmailservershostname$+">")
Greets, hoerbie
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: Sending mails to Gmail needs Message-ID

Post by BarryG »

Weird. I don't need to set a Message ID to send emails both to or from Gmail. I just tried again to check, and nope, not needed here.

Are you using an app password like I said here? -> https://www.purebasic.fr/english/viewto ... 27#p586827
User avatar
NicTheQuick
Addict
Addict
Posts: 1224
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: Sending mails to Gmail needs Message-ID

Post by NicTheQuick »

I guess it depends on from which server you actually send the mail. If it was gmail itself it works and if it was an other mail server then it does not work?
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
hoerbie
Enthusiast
Enthusiast
Posts: 119
Joined: Fri Dec 06, 2013 11:57 am
Location: DE/BY/MUC

Re: Sending mails to Gmail needs Message-ID

Post by hoerbie »

Hi,

I don't use Gmail as sender, so there are no problems with their app passwords. My tip is for Gmail as ending receiver of a sent mail.

I'm using smtp from PB to my own linux server with s/qmail mail server software hosted in a german data center. This server has a standard configuration like a lot other servers, and it delivers the mails then to Gmail and others.
Maybe other mail server software automatically insert a Message-ID when it is missing, and then there is no problem?

Greets, hoerbie
Post Reply