curl-users
Mail received but message body is empty
Date: Fri, 23 Jun 2017 13:19:47 +0000
Hi all,
Solved it!
The problem was the content of the mailtxt.txt.
All the required CRLF as described in RFC 5322 <https://tools.ietf.org/html/rfc5322.html> were missing in the content of the file.
Specifically after the last header and all the CRLF in the message body.
In VIM and VI you can create the DOS version of CRLF that are needed by typing CTRL-V followed by CTRL-M.
So curl does exactly what it is supposed to do conform RFC 5322. For me a reminder to RTFM :-)
My original file, content of the file is in between "---------": (created in VIM)
Output is from the command: cat -eT ./mailtxt.txt
it will show the $ character for the linux variant of CRLF.
The message text is ignored by the MS Exchange server. Only the subject is in the received e-mail.
---------
From: "server1" <server1_at_domain.com>$
To: "myemailaddress" <myemailaddress_at_domain.com>$
Subject: This is a test from server1$
Content-Type: text/plain; charset="us-ascii"$
Content-Transfer-Encoding: quoted-printable$
MIME-Version: 1.0$
$
This should be the e-mail text in plain text format$
and this could go on for multiple lines$
$
.$
$
---------
My new altered mailtxt.txt, content of the file is in between "---------": (created in VIM)
Output is from the command: cat -eT ./mailtxt.txt
it will show the ^M characters for the DOS variant of CRLF, followed by the $.
When I send this with the curl command to the MS Exchange server, I receive an e-mail with the subject and the message text!! 😊
---------
From: "server1" <server1_at_domain.com>$
To: "myemailaddress" <myemailaddress_at_domain.com>$
Subject: This is a test from server1$
Content-Type: text/plain; charset="us-ascii"$
Content-Transfer-Encoding: quoted-printable$
MIME-Version: 1.0^M$
^M$
This should be the e-mail text in plain text format^M$
^M$
and this could go on for multiple lines^M$
^M$
$
---------
Thanx for all the answers and I hope this helps for future questions regarding curl and SMTP messages towards an MS Exchange host.
grtz,
Dutch Raf
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-06-23