Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good Morning,

I'm making a program to send a few e-mails. I'm talking to smtp.sapo.pt
but a have a problem.
When a link with the server i receive this message
Quote:
"220 SAPO.pt PTMailServer mta15 ESMTP SPF1"
by using c sockets and telnet.

Then i reply in c this command
C#
tester=send(sock,"MAIL FROM: brunoteixeira92@sapo.pt",34,0);
tester=recv(sock,buffer,buf,0);

If i do this in telnet in responds "250 ok" but if i send it throw sockets it returns once again
Quote:
"220 SAPO.pt PTMailServer mta15 ESMTP SPF1"


I think that the server isn't processing my command. i think that i need to include a enter in my string.

Need help, ty
Posted

You need to send a "HELO" command first to initiate a mail exchange, as described in RFC 2821[^].
 
Share this answer
 
Try "\n" and/or "\r" in your string - it depends on the remote equipment whether it wants CR or LF or CR+LF (probably "\r" for CR will do, but try "\n" first).
 
Share this answer
 
Comments
markkuk 1-Dec-11 5:59am    
SMTP standard requires that lines end with the CR+LF combination.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900