We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Getting messages from POP 3 after sending mail with SMTP client

This is a post related to my previous pop3 post. For this I downgraded from 4.9 to 4.7.2.4. I am having issues when I try to receive a message via pop3, then immediately send a response to that message and then retieve next message. Here is some sample code that shows the issue:

private void btnCheckandReply_Click(object sender, EventArgs e)

{

Aspose.Network.License AspLicense = new Aspose.Network.License();

AspLicense.SetLicense("Aspose.Total.lic");

Aspose.Network.Pop3.Pop3Client mail = new Pop3Client(txtPopHost.Text, Convert.ToInt32(txtPopPort.Text), txtUserName.Text, txtPassword.Text, SSLCheck);

mail.Connect();

mail.Login();

Aspose.Network.Pop3.Pop3MessageInfoCollection info = new Pop3MessageInfoCollection();

info = mail.ListMessages();

int MessageCount = info.Count;

foreach (Aspose.Network.Pop3.Pop3MessageInfo msg in info)

{

txtResults.Text += msg.Subject + "\r\n";

int msgID = msg.SequenceNumber;

Aspose.Network.Mail.MailMessage eMsg = mail.FetchMessage(msgID);

Aspose.Network.Mail.SmtpClient smtp = new SmtpClient(txtSmtpHost.Text, Convert.ToInt32(txtSmtpPort.Text));

Aspose.Network.Mail.MailMessage mm = new MailMessage("noreply@company.com", "myname@company.com", "testMessage", "TestBody");

smtp.Send(mm);

}

}

The exception I am receiving is "Smtp server returned an invalid response", the strange thing is this exception was during a pop3 operation not a smtp operation. In the above for each loop, everything works the first round (including the send) but fails on the FetchMessage call on the second round (there are 3 messages in the pop3 mailbox).

This pop3 server is an Exhange 2003 server (but I can't use the exchange namespace since I need to maintain compatibility with other pop3 servers), for the SMTP I have tried both a sendmail server as well as the Exhange 2003 server.

Thanks again,

Rick

Hi Rick,

We will look into it and will get back to you soon. Sorry for the inconvenience.

Thank you, I have now switched to 4.8.1.2 and it seems to have the same issue as 4.9 (exception when listing messages). Thanks for looking into this though. Do you have an example of how to use the ssl callback function, the one I used for a web request does not seem to work. I assume there is a way to detect the type of certificate error in this callback but don't know how,

Rick