cagespear
06-27-2008, 02:23 AM
I am using RWSmtpclient to send mails to the user. It works fine 99% of the time. But lately, some users are sporadically getting the below errors
RWSocketError: in RWSocket::connect::CONNREFUSED
I am using the same code as what the API suggests -
***********************************************
RWSmtpClient client; // SMTP client object
RWSmtpReply reply; // SMTP general reply
RWSmtpDataReply dReply; // SMTP data reply
try {
// Connect to our SMTP server
reply = client.connect("smtp.roguewave.com");
// Say hello from the local machine
reply = client.helo("tsunami");
// Mail From: and To:
reply = client.mail("customer.roguewave.com");
reply = client.rcpt("support.roguewave.com");
// Send a help message
dReply = client.dataOpen();
dReply.portal().sendAtLeast("We've got a problem... \n");
dReply.portal().sendAtLeast("Please help immediately");
// Indicate it's the end of the message
reply = client.dataClose();
// Send more messages, if you like
// Finally shut down the connection
reply = client.quit();
}
catch (const RWxmsg& m) {
cout << "Error : " << m.why() << endl;
***********************************************
Its seems to me that smtp server refused the connection in this case. But the question is Why ? The same user who reported this error *is* still able to send mails but sometimes this error comes.
The other qn is - what should be the right approach to handle such errors ? Should I try to re-send the mail in such case ? Or print some more logs for debugging purpose ?
Thanks
cage
RWSocketError: in RWSocket::connect::CONNREFUSED
I am using the same code as what the API suggests -
***********************************************
RWSmtpClient client; // SMTP client object
RWSmtpReply reply; // SMTP general reply
RWSmtpDataReply dReply; // SMTP data reply
try {
// Connect to our SMTP server
reply = client.connect("smtp.roguewave.com");
// Say hello from the local machine
reply = client.helo("tsunami");
// Mail From: and To:
reply = client.mail("customer.roguewave.com");
reply = client.rcpt("support.roguewave.com");
// Send a help message
dReply = client.dataOpen();
dReply.portal().sendAtLeast("We've got a problem... \n");
dReply.portal().sendAtLeast("Please help immediately");
// Indicate it's the end of the message
reply = client.dataClose();
// Send more messages, if you like
// Finally shut down the connection
reply = client.quit();
}
catch (const RWxmsg& m) {
cout << "Error : " << m.why() << endl;
***********************************************
Its seems to me that smtp server refused the connection in this case. But the question is Why ? The same user who reported this error *is* still able to send mails but sometimes this error comes.
The other qn is - what should be the right approach to handle such errors ? Should I try to re-send the mail in such case ? Or print some more logs for debugging purpose ?
Thanks
cage