0

I am trying to send mail from the command line using the openssl. I am able to connect to the smtp server of gmail on port 465 and also the authentication is successful . The MAIL FROM and rcpt to also work fine . Next when i enter data it gives me a 354 with go ahead which is also very fine . In the data i enter the following :

FROM: <[email protected]>
To: <[email protected]> // I am sending and receiving the mail to my account itself for test purposes
Subject: test

hello!
.

Now comes the problem , after i enter the . , the cursor just blinks , i am not getting the 250 OK , queued for delivery response .

Pls help !!

I am trying all this on ubuntu 9.10.

3 Answers 3

2

argh ... yet after reading this topic, it took me hours to find out!!

posting my solution here:

everywhere on the internet they are telling you you should use the -crlf switch to the initial connection command - wich I did.

However ... this is only true for Linux/unix! On Windows you must not use this switch!

0

the . needs to be on a single line by itself... followed by another carriage-return...

i.e.

Hello!
.

(that might have been serverfault's formatting that screwed it up... but check.)

in-code... it should be <cr>.<cr> or use a crlf instead of just a cr.

1
  • @Compwiz: I have not written a code , just trying to send mail from the terminal itself . The . is on a single line by itself (enter after hello! then dot and then enter again ) , i still have the same issues.
    – linuxnewbie
    Sep 13, 2010 at 19:15
0

I was having this problem (just with gmail) and saw this question. I eventually figured out that building a CRLF and sending it instead of '\n' fixed the problem.

char eol[3];
eol[0] = '\r';
eol[1]= '\n';
eol[2] = '\0';
string crlf = string(eol);

string endit(crlf + '.' + crlf);
send(socket_id, endit.c_str(), endit.length(), 0) < 0);

You must log in to answer this question.