curl / Mailing Lists / curl-users / Single Mail

curl-users

RE: Mail received but message body is empty

From: Bill Mercer <bmercer_at_nccer.org>
Date: Fri, 23 Jun 2017 22:43:47 +0000

A useful method for troubleshooting SMTP issues is to telnet into the mail server’s mail port, and then manually type in or copy and paste in the SMTP commands which will reproduce the thing you’re trying to accomplish. This will let you see how the input is received and handled by the SMTP server, and help you determine if the problem is with your input rather than whatever software you’re using.

After a little practice, you can create a text file with all of the SMTP commands and the message body, and just pipe it to telnet or use netcat.


From: curl-users [mailto:curl-users-bounces_at_cool.haxx.se] On Behalf Of Dutch Raf via curl-users
Sent: Friday, June 23, 2017 9:20 AM
To: curl-users_at_cool.haxx.se
Cc: Dutch Raf
Subject: Mail received but message body is empty


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<mailto:server1_at_domain.com>>$
To: "myemailaddress" <myemailaddress_at_domain.com<mailto: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<mailto:server1_at_domain.com>>$
To: "myemailaddress" <myemailaddress_at_domain.com<mailto: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-24