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

Free Support Forum - aspose.com

Handling bounce mail

Hi, I am planning to buy aspose.network.

before that i would like to know the following details.

1)how can i handle bounce email

This message was posted using Aspose.Live 2 Forum


Thanks for considering Aspose.

Aspose.Network implements smtp, pop3, imap etc protocols to send and receive emails. Using Smtp classes, you can send emails to 1 or more email addresses. If the email address is not valid and smtp server cannot deliver the email, it sends a message to the sender that email cannot be delivered. Aspose.Network implements an smtp client and can only send/receive messages to/from smtp server.

However, if any failed delivery messages arrive at the sender’s address, Pop3 classes can check the Inbox for such failed deliveries.

Moreover, we also have EmailValidator class that can check syntax errors in email address and check whether the address exists on the mail server or not.

hi saquib

thanks for the reply. but i am bit confused. if one mail is bounced; how can the system will identify for what reason the mail is bounced???

if its an auto reply then how should the system understand it??

i am asking this because i need to save the .msg to the database. if its a bounce mail i need to forward it to another email id..



Hi Binoy,

Auto-reply emails depend on the settings of email account on the mail server. For example, In Gmail settings --> General --> Vacation Responder, I can set a “subject” and “message” of my choice to auto-reply to any message that I receive during the specified dates. Similar settings can also be defined in other mail servers.

Since, Aspose.Network in a pop3 client, you can check Inbox and find strings like “Delivery failed” or any other string e.g. “Vacation” or “holiday” in subject or body of email, to recognize such auto-reply messages. Again, this depends on the settings defined on the mail servers, so it’s better to know in advance, what subject or body an auto-reply message contains.

Below code snippet can give an idea to implement such solution:
// connect to pop3 mailbox
Pop3Client client = new Pop3Client(“host”, 110, “user”, “pwd”);
// get list of messages
Pop3MessageInfoCollection msgInfoCollection = client.ListMessages();
// loop through all the messages to find a specific message
foreach (Pop3MessageInfo msgInfo in msgInfoCollection)
// try finding a string in subject
if (msgInfo.Subject.Contains(“delivery failed”) == true /* || any other criteria */)
SmtpClient smtp = new SmtpClient(“host”, 25, “user”, “pwd”);
// get this message in MailMessage instance
MailMessage msgToSend = client.FetchMessage(msgInfo.SequenceNumber);
// update the recipients
msgToSend.To.Add(new MailAddress("newaddress@domain.com"));
// send this message