Asked by:
HOW to check for Bounced Mails using SMTP

General discussion
-
Hi,
I need to develop an application that can read the undeliverable mails and make an entry into the database about all these mails.
i m using following code to get mails from server
-----code start
Private
Sub InitializeConnection(ByVal hostname As String, ByVal port As Integer)
Try
_imapClient =
New TcpClient(hostname, port)
_imapNs = _imapClient.GetStream()
_imapSw =
New StreamWriter(_imapNs)
_imapSr =
New StreamReader(_imapNs)
Response.Write(
"*** Connected ***" & "<br></br>")
Catch ex As SocketException
Console.WriteLine(ex.Message)
End Try
End Sub
Private Function Responses() As String
Dim data As Byte() = New Byte(_imapClient.ReceiveBufferSize - 1) {}
Dim ret As Integer = _imapNs.Read(data, 0, data.Length)
Return Encoding.ASCII.GetString(data).TrimEnd()
End Function
Public Sub AuthenticateUser(ByVal username As String, ByVal password As String)
_imapSw.WriteLine((
"$ LOGIN " & username & " ") + password)
_imapSw.Flush()
Response.Write(Responses() &
"<br>")
End Sub
Public Function MailCount() As Integer
_imapSw.WriteLine(
"$ STATUS INBOX (messages)")
_imapSw.Flush()
Dim res As String = Responses()
Dim m As Match = Regex.Match(res, "[0-9]*[0-9]")
Return Convert.ToInt32(m.ToString())
End Function
Public Function MailUnreadCount() As Integer
_imapSw.WriteLine(
"$ STATUS INBOX (unseen)")
_imapSw.Flush()
Dim res As String = Responses()
Console.WriteLine(res)
Dim m As Match = Regex.Match(res, "[0-9]*[0-9]")
Return Convert.ToInt32(m.ToString())
End Function
---- code end
---- output
*** Connected ***
220 kingsin.kingsbus.local Microsoft ESMTP MAIL Service ready at Tue, 12 May 2009 11:00:47 +0100
500 5.3.3 Unrecognized command
500
500
-----------------
getting unrecognized command error
How to read mails from mail server?
Regards,
Rushabh D. Vipani.- Changed type Xingwei Hu Monday, May 18, 2009 7:26 AM asp.net question
Tuesday, May 12, 2009 10:34 AM
All replies
-
Hi Ruvi,
For questions regarding any kind of WebForms project, such as ASP .Net Websites and WebServices, please use http://forums.asp.net/These forums (forums.microsoft.com/msdn) are for Windows Forms (desktop) applications and services.Development for the web is a very broad topic and differs in many ways from development for the desktop. Because of this, Microsoft has a dedicated community for web development. The asp.net website contains information about all aspects of web development, including not only Visual Studio related content, but also IIS, SQL, and many other supporting technologies.
Here is a direct link to the VB language specific section of the site: http://forums.asp.net/36.aspx
Please join the asp.net community for the best response to .Net web development related questions.
There is a forum here at MSDN for Web Services and XML Serialization because these topics are purely about code and do not involve WebForms. If your question is specificaly about Web Service code or XML Serialization, you may post it at http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=46&SiteID=1. However, you are still encouraged to use the asp.net website as there are more active web gurus there.
Best wishes
Xingwei Hu
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.Monday, May 18, 2009 7:26 AM -
Hi Ruvi,
For questions regarding any kind of WebForms project, such as ASP .Net Websites and WebServices, please use http://forums.asp.net/These forums (forums.microsoft.com/msdn) are for Windows Forms (desktop) applications and services.Development for the web is a very broad topic and differs in many ways from development for the desktop. Because of this, Microsoft has a dedicated community for web development. The asp.net website contains information about all aspects of web development, including not only Visual Studio related content, but also IIS, SQL, and many other supporting technologies.
Here is a direct link to the VB language specific section of the site: http://forums.asp.net/36.aspx
Please join the asp.net community for the best response to .Net web development related questions.
There is a forum here at MSDN for Web Services and XML Serialization because these topics are purely about code and do not involve WebForms. If your question is specificaly about Web Service code or XML Serialization, you may post it at http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=46&SiteID=1. However, you are still encouraged to use the asp.net website as there are more active web gurus there.
Best wishes
Xingwei Hu
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Hi Hu,
From what you got the idea this is AspNet.
I see that it is InterNet and probably Exchange Server but that is not direct AspNet
But maybe I see something wrong
I don't have the answer, probely this is lately already asked by Ruvi in the newsgroups.
It looks for me a little bit around Exchange Server (Not Outlook)
Greeting
CorMonday, May 18, 2009 7:49 AM