托管我的应用程序时发送邮件时出现问题 [英] Problem in sending mail when i host my application

查看:156
本文介绍了托管我的应用程序时发送邮件时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个发送邮件的电子邮件功能。当我通过vs 2010运行它时,它在本地电脑上发送邮件,



但是当我托管应用程序时它无法发送邮件..



可能出现什么问题?



我在bigrock服务器上托管我的应用程序..并使用gmail帐户发送邮件。



端口问题是不是?或者我必须与bigrock讨论

解决方案

我在vb.net中有完整的工作代码来转换它在C#中你可以访问http://converter.telerik.com/ [ ^ ]



 Imports System.Net.Mail 
Imports System.Net
Partial类_Default
继承System.Web.UI.Page

受保护的子SendMail()
' 发送邮件的Gmail地址
Dim fromAddress =user@domain.com
'
任何地址其中电子邮件将发送
Dim toAddress =( recevier@domain.com

Const fromPassword As String = 密码
' 传递值并制作电子邮件格式以显示
Dim subject As String =(Abccc)
Dim body As String =这是您的电子邮件正文+ vbLf
'
smtp设置
Dim smtp =新的System.Net.Mail.SmtpClient()
如果为True那么
smtp.Host = smtp.domainname.net
smtp.Port = 25
smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network
smtp.Credentials = New NetworkCredential(fromAddress,fromPassword)
smtp.Timeout = 20000
结束如果
' 将值传递给smtp对象
smtp.Send( FROMADDRESS, toAddress,subject,body)
End Sub


Protected Sub btn_Click(ByVal sender As Object,ByVal e As System.EventArgs)处理btn.Click
试试
SendMail()
Catch generatedExceptionName As Exception
End Try
End Sub

End Class


您好


您的IIS服务器上的Bigrock配置是否具有SMTP服务和中继服务器配置?

请查看Bigrock for SMTP服务器姓名和端口号?



问候,

timcyspet


I have a email function to send mail. It is sending mail in local pc when i run it through vs 2010,

But When i host application it is unable to send mail..

What could be the possible problem ?

I am hosting my application on bigrock server ..and using gmail account to send mail.

Is ths problem of port no ? Or i have to discuss with bigrock

解决方案

I have complete working code in vb.net to convert it in C# you can visit http://converter.telerik.com/[^]

Imports System.Net.Mail
Imports System.Net
Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub SendMail()
        ' Gmail Address from where you send the mail
        Dim fromAddress = "user@domain.com"
        ' any address where the email will be sending
        Dim toAddress = ("recevier@domain.com")

        Const fromPassword As String = "Password"
        ' Passing the values and make a email formate to display
        Dim subject As String = ("Abccc")
        Dim body As String = "this is body of your email " + vbLf
        ' smtp settings
        Dim smtp = New System.Net.Mail.SmtpClient()
        If True Then
            smtp.Host = "smtp.domainname.net"
            smtp.Port = 25
            smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network
            smtp.Credentials = New NetworkCredential(fromAddress, fromPassword)
            smtp.Timeout = 20000
        End If
        ' Passing values to smtp object
        smtp.Send(fromAddress, toAddress, subject, body)
    End Sub


    Protected Sub btn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn.Click
        Try
            SendMail()
        Catch generatedExceptionName As Exception
        End Try
    End Sub
   
End Class


Hi
Bigrock configuration on your IIS server with SMTP Service and Relay server configuration?
Please check with Bigrock for SMTP server name and port number?

Regards,
timcyspet


这篇关于托管我的应用程序时发送邮件时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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