Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

smtp problem

Status
Not open for further replies.

Slonoma

Programmer
Jul 10, 2003
41
US
Hi all,

I am writing a simple mail program with C++.
Here is ths code:

//MAIL command to server
write(sock, "MAIL FROM:", 10);
write(sock, this->sender.c_str(), sizeof(this->sender.c_str()));
write(sock, "\n", 1);

And here is the error I get when I run it:
To Server: MAIL FROM:<fakeName@fake.com>
From Server: 500 5.5.1 Command unrecognized: ""

I've been stuck on this for a while, I'm hoping someone will see something I cannot.

Thanks!
Slo-No

The trouble with programmers is that they get high on their own supply. -Dimandja
 
1. Download ethereal from 2. Observe what a real email client does
3. Observe what your program does
4. Compare and contrast.

> write(sock, this->sender.c_str(), sizeof(this->sender.c_str()));
My guess is you meant strlen(), not sizeof()

--
 
Thanks for the help.

Turns out if I sent an RSET command before the MAIL command it works...

But the server returns that it does not know what RSET is.

I hate computers.


The trouble with programmers is that they get high on their own supply. -Dimandja
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top