با سلام . من تقریبا کل انجمن های فارسی رو من جمله مجید آنلاین رو زیرو رو کردم ولی یه سورس کد بدر بخور برای ارسال ایمیل گیر نیاوردم . !!!
این چند خط رو از یه سایت گرفتم . به ظاهر هیچ مشکلی نداره ولی خطا میده .
فایل VBMail2.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="VBMail2.aspx.vb" Inherits="VBMail1" Debug="true" %>
<!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 id="Head1" runat="server">
<title>Send Email</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<p>authenticated email send (VBMail1):</p>
<asp:Button ID="Button1" runat="server" Text="Push to send the email" /></div>
</form>
</body>
</html>
فایل کد بیهایند VBMail2.aspx.vb
Imports System.Net.Mail
Partial Class VBMail1
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Mail As New System.Net.Mail.MailMessage()
With Mail
.To.Add("me@ ... .ir")
.From = New Net.Mail.MailAddress("info@. ... .ir")
.Subject = "This came from VBMail1"
.Body = "This is a Test"
End With
'
Dim SMTP As New Net.Mail.SmtpClient("stmp. ... .ir/") '
SMTP.Credentials = New System.Net.NetworkCredential("info@ ... .ir", "...")
SMTP.Port = 21
SMTP.Host = "localhost"
SMTP.EnableSsl = True
SMTP.Send(Mail)
SMTP = Nothing
Mail.Dispose()
'
response.write("Your message was sent!")
End Sub
End Class
خیلی ممنون می شم اگه این کد رو تصحیح کنید یا یه کد صحیح ارسال کنید.
این چند خط رو از یه سایت گرفتم . به ظاهر هیچ مشکلی نداره ولی خطا میده .
فایل VBMail2.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="VBMail2.aspx.vb" Inherits="VBMail1" Debug="true" %>
<!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 id="Head1" runat="server">
<title>Send Email</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<p>authenticated email send (VBMail1):</p>
<asp:Button ID="Button1" runat="server" Text="Push to send the email" /></div>
</form>
</body>
</html>
فایل کد بیهایند VBMail2.aspx.vb
Imports System.Net.Mail
Partial Class VBMail1
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Mail As New System.Net.Mail.MailMessage()
With Mail
.To.Add("me@ ... .ir")
.From = New Net.Mail.MailAddress("info@. ... .ir")
.Subject = "This came from VBMail1"
.Body = "This is a Test"
End With
'
Dim SMTP As New Net.Mail.SmtpClient("stmp. ... .ir/") '
SMTP.Credentials = New System.Net.NetworkCredential("info@ ... .ir", "...")
SMTP.Port = 21
SMTP.Host = "localhost"
SMTP.EnableSsl = True
SMTP.Send(Mail)
SMTP = Nothing
Mail.Dispose()
'
response.write("Your message was sent!")
End Sub
End Class
خیلی ممنون می شم اگه این کد رو تصحیح کنید یا یه کد صحیح ارسال کنید.