Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
9
Erster Beitrag:
vor 3 Monaten
Letzter Beitrag:
vor 3 Monaten
Beteiligte Autoren:
Arie, Ola, Eric Wiegert, Peter Holemans, Sammy Broeders

WD21 - email error : '550 Subject contains invalid characters.''

Startbeitrag von Arie am 23.05.2017 09:09

I'm using WD21 to send email to customers. Some of these email are rejected by the RECEIVERS provider with the following message

Remote Server returned '550 Subject contains invalid characters.'

The subject of the email is this : I can only think "ä" being the problem. Can anyone confirm that?
Do I need some kind of UTF8 conversion before sending?

I'm using this simplified code

MyEmail is Email
MySession is EmailSMTPSession
MySession..ServerAddress = etc (using company Exchange server)

Email.Subject = 'Bestätigung Termin Hausbegehung Deutsche Glasfaser'
Email.HTML = etc

EmailStartSession(MySession)
EmailSendMessage(MySession,MyEmail)

Antworten:

Mmh something is missing in my post

The subject of the email is this : Bestätigung Termin Hausbegehung Deutsche Glasfaser

von Arie - am 23.05.2017 10:11
Arie,

I had this before, the " ä " is the problem.

Sammy

von Sammy Broeders - am 23.05.2017 11:38
Hi Arie,

Are you in ANSI or in UNICODE mode?

Cheers,

Peter Holemans

von Peter Holemans - am 23.05.2017 11:39
Hi Peter,

ANSI mode

I also tried
myEmail.Subject = AnsiToUnicode(myEmail.Subject)
with no luck

I could try to switch to UNICODE (with a new project configuration), but will that work out of the box or do I run into other conversion issues then?

von Arie - am 23.05.2017 12:03
Hi Sammy,

can you remember the solution as well :)

I already created a support ticket at the hosting provider. Maybe they have an option to allow these characters?
Because I don't have this issues with other emailadresses (hosted elsewhere).
fyi: it's the receiving host which blocks these email, sending is not the problem. Even when using the same provider for sending.....

von Arie - am 23.05.2017 12:06
Arie

email header text is limited to ASCII only

RFC-2822

"Header fields are lines composed of a field name, followed by a colon (":"), followed by a field body, and terminated by CRLF. A field name MUST be composed of printable US-ASCII characters (i.e., characters that have values between 33 and 126, inclusive), except colon."

there is a work around to represent non ASCII characters inside e-mail headers in a way that won’t confuse e-mail servers.
You can specify the content-type in an e-mail header
The encoding must be either B or Q, these mean base 64 and quoted-printable respectively. You can read the RFC 1342 document for more information about how they work.

To encode a header using this technique you must use this format:
=?charset?encoding?encoded-text?=

And this is an example of its use:
=?utf-8?Q?hello?=

You should prefer using quoted-printable as there is no need to encode binary data in subjectlines. Some spamfilters like SpamAssassin, which warns senders against using strange characters, might classify Base64 as a means to obfuscate something

I have not had the need to do this so I can't give insights as to Windev specific issues

Eric W

von Eric Wiegert - am 23.05.2017 13:04
Erik,

sounds exactly what is going on. And I would expect PCSOFT to handle all this for me.
Surprise suprise they do! There is an option emailOptionEncodeHeader which seems to solve this case. I must missed that before in the help

EmailSendMessage(MySession,MyEmail,emailOptionEncodeHeader)

Not sure if that can be the default for all email handling. We will see.

von Arie - am 23.05.2017 14:54
Hi Arie,

I have used the "emailOptionEncodeHeader" option in all my emails now for several years without any problems.

Best regards
Ola

von Ola - am 24.05.2017 09:59
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.