Click here to Skip to main content
15,885,896 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
Posted
Comments
bbirajdar 14-Dec-12 0:38am    
your last statement is the answer...

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

C#
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
 
Share this answer
 
v2
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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900