System.Web.Mail
i'm very new in vb.net and using web developer 2005 express edition.
i'll try to bulit one application which it can send mail.
i had read so many discussions about email and try to implement in my sourcecode but problem with system.web.mail.i did'nt know where to add the System.Web.Mail in reference .
# 3 Re: System.Web.Mail
Below is my failed sourcecode:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:LinkButton ID="LinkButton1_click" runat="server">LinkButton</asp:LinkButton></div>
</form>
</body>
</html>
p/s:HTML CODE FOR CALLING SUB OF LINKBUTTON1_CLICK
'------------------------
Imports System.Net.Mail
Private Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton1.Click
Dim email As New System.Net.Mail.MailMessage()
email.To = "test@yahoo.com"
email.From = "try@yahoo.com"
email.Body = "test"
email.Subject = "test"
System.Net.Mail.SmtpMail.SmtpServer = "mail.yahoo.com"
System.Net.Mail.SmtpMail.Send(email)
End Sub
# 4 Re: System.Web.Mail
I have never tried using it with other mail clients except for the default exchange server. Although from what I can see in the posted code is that you are not sending the User ID and Password for authentication. Wihtout authentication you will not be able to send an email. Take a look at this article which uses GMAIL in both .NET 1.1 & 2.0.
http://www.codeproject.com/useritems/SendMailUsingGmailAccount.asp
Although it is a C# code, you should be able to understand how to do the authentication part.