|
Subject:
|
Email in asp.net
|
|
Posted By:
|
asif_sharif
|
Post Date:
|
1/5/2006 8:25:33 AM
|
Hi, I am making an email group like yahoo or msn groups in asp.net, in which i want to receive email from any where and then i want to send it to all user which are in group and also display the email at group's page how i can do this please help, thanks in advance
asif
|
|
Reply By:
|
jbenson001
|
Reply Date:
|
1/5/2006 12:35:12 PM
|
There are plenty of examples on line if you just take the time to search a little. Once you have tried something and are having problems, then we can help.
|
|
Reply By:
|
asif_sharif
|
Reply Date:
|
1/6/2006 9:23:00 AM
|
thanks for your suggestion but if you can sent me some links i will very thankful to you
asif
|
|
Reply By:
|
calorisplanitia
|
Reply Date:
|
2/23/2006 6:05:29 AM
|
Hi, I am new to this forum & asp.net. Iam trying to write a web-based application to read my emails through webpage(pop account). I had done this in ASP using CDO session. Now what i thought is we can do this much easily in ASP.NET(System.Web.mail), however this turned false. I tried system.net through which i could get the no of emails etc. But i cannot see or display the messages in the browser or can say cannot extract the body of the message.So can anybody help me on that.I do not want to use any commercial components.
THE CODE I AM USING GOT THROUGH SOME WEBSITE works well
Imports System
Imports System.Text
Imports System.Net
Public Class email
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private tcpC As New Sockets.TcpClient
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ReadMail("mail.calorisplanitia.com", "abc@calorisplanitia.com", "password")
End Sub
' send command strings and return the response
Function SendCommand(ByRef netstream As System.Net.Sockets.NetworkStream, ByVal sToSend As String)
Dim bData() As Byte = Encoding.ASCII.GetBytes(sToSend.ToCharArray)
netstream.Write(bData, 0, bData.Length())
Return GetResponse(netstream)
End Function
' check if there is a response to get and return it
Function GetResponse(ByRef netstream As System.Net.Sockets.NetworkStream)
Dim bytes(tcpC.ReceiveBufferSize) As Byte
Dim ret As Integer = netstream.Read(bytes, 0, bytes.Length)
' Returns the data received
Dim returndata As String = Encoding.ASCII.GetString(bytes)
Return returndata
End Function
Function ReadMail(ByVal host As String, ByVal user As String, ByVal pass As String)
' initialise objects
Dim netstream As System.Net.Sockets.NetworkStream
Dim thisResponse As String
' open connection to server
Try
tcpC.Connect(host, 110)
Catch ex As Exception
Response.Write("Error connecting to host: " & ex.Message & " - Please check your details and try again")
Response.End()
End Try
' get response
netstream = tcpC.GetStream()
thisResponse = GetResponse(netstream)
' enter user name
thisResponse = SendCommand(netstream, "user " & user & vbCrLf)
' enter password
thisResponse = SendCommand(netstream, "pass " & pass & vbCrLf)
' check if logged in ok
If Not Left(thisResponse, 4) = "-ERR" Then
Response.Write("<font face=courier>Logged in OK </font><BR>")
Else
Response.Write("Error logging in, check your user details and try again<BR>")
Response.Write("<P>" & thisResponse & "</p>")
Response.End()
End If
thisResponse = SendCommand(netstream, "stat" & vbCrLf)
Dim tmpArray() As String
tmpArray = Split(thisResponse, " ")
Dim thisMess As Integer
Dim numMess As String = tmpArray(1)
Response.Write("<hr>")
thisResponse = ""
If CInt(numMess) > 0 Then
Response.Write("Messages: " & numMess & "<br>")
For thisMess = 1 To CInt(numMess)
thisResponse += Replace(SendCommand(netstream, "top " & thisMess & " 10" & vbCrLf), vbCrLf, "<br>")
Next
Else
Response.Write("Messages: None" & "<br>")
End If
thisResponse += Replace(SendCommand(netstream, "stat" & vbCrLf), vbCrLf, "<br>")
tmpArray = Split(thisResponse, "+OK")
Response.Write(thisResponse & "<br>--------------------------------------------<br>")
Dim msg As Integer
For msg = 1 To tmpArray.Length - 1
Response.Write("<h3>#" & msg & "</h3><pre>" & tmpArray(msg) & "</pre>")
Next
' close connection
thisResponse = SendCommand(netstream, "QUIT" & vbCrLf)
tcpC.Close()
End Function
End Class
|
|
Reply By:
|
suryasimha
|
Reply Date:
|
9/21/2006 7:31:43 AM
|
How to get addresses in contacts..using this code
|