smtp.Send失败 [英] smtp.Send fail

查看:97
本文介绍了smtp.Send失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我有一个包含以下字段的表格:


UserEmail

主题

正文


提交表单后,电子邮件处理得很好。当我尝试将
添加到mm.body(mm.Body = Body.Text&

Listbox1.SelectedItem.Text)时,smtp.Send失败。任何想法?

代码:


< script runat =" server">

受保护的子SendEmail_Click(ByVal发送者) As Object,ByVal e As

System.EventArgs)处理SendEmail.Click

''!!!将此值更新为您的电子邮件地址

Const ToAddress As String =" ab*@abc.com"


''(1)创建MailMessage实例

Dim mm As New Net.Mail.MailMessage(UsersEmail.Text,ToAddress)


''(2)分配MailMessage的属性

mm.Subject = Subject.Text

mm.Body = Body.Text& TextBox1.Text

mm.IsBodyHtml = False


''(3)创建SmtpClient对象

Dim smtp As New Net .Mail.SmtpClient


''(4)发送MailMessage(将使用Web.config设置)

smtp.Send(mm)

结束子

< / script>



I have a form with the following fields:

UserEmail
Subject
Body

When the form is submitted, the email is processed fine. When I try
to add another field to the mm.body (mm.Body = Body.Text &
Listbox1.SelectedItem.Text) the smtp.Send fails. Any ideas ?
Code:

<script runat="server">
Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles SendEmail.Click
''!!! UPDATE THIS VALUE TO YOUR EMAIL ADDRESS
Const ToAddress As String = "ab*@abc.com"

''(1) Create the MailMessage instance
Dim mm As New Net.Mail.MailMessage(UsersEmail.Text, ToAddress)

''(2) Assign the MailMessage''s properties
mm.Subject = Subject.Text
mm.Body = Body.Text & TextBox1.Text
mm.IsBodyHtml = False

''(3) Create the SmtpClient object
Dim smtp As New Net.Mail.SmtpClient

''(4) Send the MailMessage (will use the Web.config settings)
smtp.Send(mm)
End Sub
</script>

推荐答案

服务器是否有smtp


如果不是你需要告诉smtpclient在哪里找到一个


Dim message As New MailMessage(" sender @ address","来自@ address"," Subject",

" Message Text")

Dim emailClient As New SmtpClient(" Email Server Name")


emailClient.Send(留言)


< bg ******** @ yahoo.comwrote in message

news:11 ********************** @ w3g2000hsg.googlegro ups.com ...
Does the server have smtp

if not you need to tell smtpclient where to find one

Dim message As New MailMessage("sender@address", "from@address", "Subject",
"Message Text")

Dim emailClient As New SmtpClient("Email Server Name")

emailClient.Send(message)

<bg********@yahoo.comwrote in message
news:11**********************@w3g2000hsg.googlegro ups.com...

>


我有一个包含以下字段的表单:


UserEmail

主题

正文


表格提交后,电子邮件处理得很好。当我尝试将
添加到mm.body(mm.Body = Body.Text&

Listbox1.SelectedItem.Text)时,smtp.Send失败。有什么想法吗?


代码:


< script runat =" server">

受保护的子SendEmail_Click(ByVal sender As Object,ByVal e As

System.EventArgs)处理SendEmail.Click

''!!!将此值更新为您的电子邮件地址

Const ToAddress As String =" ab*@abc.com"


''(1)创建MailMessage实例

Dim mm As New Net.Mail.MailMessage(UsersEmail.Text,ToAddress)


''(2)分配MailMessage的属性

mm.Subject = Subject.Text

mm.Body = Body.Text& TextBox1.Text

mm.IsBodyHtml = False


''(3)创建SmtpClient对象

Dim smtp As New Net .Mail.SmtpClient


''(4)发送MailMessage(将使用Web.config设置)

smtp.Send(mm)

结束子


< / script>
>

I have a form with the following fields:

UserEmail
Subject
Body

When the form is submitted, the email is processed fine. When I try
to add another field to the mm.body (mm.Body = Body.Text &
Listbox1.SelectedItem.Text) the smtp.Send fails. Any ideas ?
Code:

<script runat="server">
Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles SendEmail.Click
''!!! UPDATE THIS VALUE TO YOUR EMAIL ADDRESS
Const ToAddress As String = "ab*@abc.com"

''(1) Create the MailMessage instance
Dim mm As New Net.Mail.MailMessage(UsersEmail.Text, ToAddress)

''(2) Assign the MailMessage''s properties
mm.Subject = Subject.Text
mm.Body = Body.Text & TextBox1.Text
mm.IsBodyHtml = False

''(3) Create the SmtpClient object
Dim smtp As New Net.Mail.SmtpClient

''(4) Send the MailMessage (will use the Web.config settings)
smtp.Send(mm)
End Sub
</script>


抱歉没有正确阅读你的帖子


尝试写作


response.write(Body.Text& Listbox1.SelectedItem.Text)


看看你得到了什么

< bg ******** @ yahoo.comwrote in message

news:11 ******* ***************@w3g2000hsg.googlegro ups.com ...
sorry did not read your post correctly

try writing

response.write(Body.Text & Listbox1.SelectedItem.Text)

see what you get
<bg********@yahoo.comwrote in message
news:11**********************@w3g2000hsg.googlegro ups.com...

>

我有一个包含以下字段的表格:


UserEmail

主题

身体


提交表单后,电子邮件处理得很好。当我尝试将
添加到mm.body(mm.Body = Body.Text&

Listbox1.SelectedItem.Text)时,smtp.Send失败。有什么想法吗?


代码:


< script runat =" server">

受保护的子SendEmail_Click(ByVal sender As Object,ByVal e As

System.EventArgs)处理SendEmail.Click

''!!!将此值更新为您的电子邮件地址

Const ToAddress As String =" ab*@abc.com"


''(1)创建MailMessage实例

Dim mm As New Net.Mail.MailMessage(UsersEmail.Text,ToAddress)


''(2)分配MailMessage的属性

mm.Subject = Subject.Text

mm.Body = Body.Text& TextBox1.Text

mm.IsBodyHtml = False


''(3)创建SmtpClient对象

Dim smtp As New Net .Mail.SmtpClient


''(4)发送MailMessage(将使用Web.config设置)

smtp.Send(mm)

结束子


< / script>
>

I have a form with the following fields:

UserEmail
Subject
Body

When the form is submitted, the email is processed fine. When I try
to add another field to the mm.body (mm.Body = Body.Text &
Listbox1.SelectedItem.Text) the smtp.Send fails. Any ideas ?
Code:

<script runat="server">
Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles SendEmail.Click
''!!! UPDATE THIS VALUE TO YOUR EMAIL ADDRESS
Const ToAddress As String = "ab*@abc.com"

''(1) Create the MailMessage instance
Dim mm As New Net.Mail.MailMessage(UsersEmail.Text, ToAddress)

''(2) Assign the MailMessage''s properties
mm.Subject = Subject.Text
mm.Body = Body.Text & TextBox1.Text
mm.IsBodyHtml = False

''(3) Create the SmtpClient object
Dim smtp As New Net.Mail.SmtpClient

''(4) Send the MailMessage (will use the Web.config settings)
smtp.Send(mm)
End Sub
</script>




另外.....


在代码周围放置一个try / catch块,看看有什么东西可以起作用

ThatsIT.net。 AU" < me @ thatsitwrote in message

news:14 ******************************** ** @ microsof t.com ...

Also.....

Put a try/catch block around the code and see what that kicks up if anything
"ThatsIT.net.au" <me@thatsitwrote in message
news:14**********************************@microsof t.com...

服务器是否有smtp


如果不是你需要告诉smtpclient在哪里找到一个


Dim message As New MailMessage(" sender @ address"," from @ address",

" Subject"," ;消息文本)


Dim emailClient As New SmtpClient(电子邮件服务器名称)


emailClient.Send(message)


< bg ******** @ yahoo.com写信息

新闻:11 ************ **********@w3g2000hsg.googlegro ups.com ...
Does the server have smtp

if not you need to tell smtpclient where to find one

Dim message As New MailMessage("sender@address", "from@address",
"Subject", "Message Text")

Dim emailClient As New SmtpClient("Email Server Name")

emailClient.Send(message)

<bg********@yahoo.comwrote in message
news:11**********************@w3g2000hsg.googlegro ups.com...

>>

我有包含以下字段的表单:

UserEmail
主题


表单提交后,电子邮件处理正常。当我尝试将另一个字段添加到mm.body(mm.Body = Body.Text&
Listbox1.SelectedItem.Text)时,smtp.Send失败。任何想法?

代码:

< script runat =" server">
受保护的子SendEmail_Click(ByVal发送者为对象,ByVal e As
System.EventArgs)处理SendEmail.Click
''!!!将此值更新为您的电子邮件地址
Const ToAddress As String =" ab*@abc.com"

''(1)创建MailMessage实例
Dim mm As New Net.Mail.MailMessage(UsersEmail.Text,ToAddress)

''(2)分配MailMessage的属性
mm.Subject = Subject.Text
mm.Body = Body.Text& TextBox1.Text
mm.IsBodyHtml = False

''(3)创建SmtpClient对象
Dim smtp As New Net.Mail.SmtpClient

''(4)发送MailMessage(将使用Web.config设置)
smtp.Send(mm)
End Sub

< / script>
>>

I have a form with the following fields:

UserEmail
Subject
Body

When the form is submitted, the email is processed fine. When I try
to add another field to the mm.body (mm.Body = Body.Text &
Listbox1.SelectedItem.Text) the smtp.Send fails. Any ideas ?
Code:

<script runat="server">
Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles SendEmail.Click
''!!! UPDATE THIS VALUE TO YOUR EMAIL ADDRESS
Const ToAddress As String = "ab*@abc.com"

''(1) Create the MailMessage instance
Dim mm As New Net.Mail.MailMessage(UsersEmail.Text, ToAddress)

''(2) Assign the MailMessage''s properties
mm.Subject = Subject.Text
mm.Body = Body.Text & TextBox1.Text
mm.IsBodyHtml = False

''(3) Create the SmtpClient object
Dim smtp As New Net.Mail.SmtpClient

''(4) Send the MailMessage (will use the Web.config settings)
smtp.Send(mm)
End Sub
</script>



这篇关于smtp.Send失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆