Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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: <xxx@gmail.com>
To: <XXX@gmail.com> // 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.

share|improve this question

3 Answers 3

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!

share|improve this answer

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.

share|improve this answer
    
@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 '10 at 19:15

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);
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.