How to send email through domain email or support@ & info@ of domain from or godaddy hosting in asp.net .net source code

How to send email through domain email or support@ & info@ of domain from or godaddy hosting.

Add this code

asp.net source code

''Please Add this code function

Function SendEmail(ByVal toemail As String) As String
        Try


            Dim [to] As String = toemail

            Dim subject As String = "Welcome To Website"  '' here subject of email
            Dim body As String = mailbody    '' please declare mailbody variable in webpage from                           ''''anywhere you set mailbody and call this function
            Dim mymail As String = "support@website.com"   '' here email of domain
            Dim mypass As String = "password"    '' here password of email
            Dim from As String = mymail
            Dim tomail As String = toemail
            Using mm As New MailMessage(mymail, tomail)
                mm.Subject = subject
                mm.Body = body

                'If fuAttachment.HasFile Then
                '    Dim FileName As String = Path.GetFileName(fuAttachment.PostedFile.FileName)
                '    mm.Attachments.Add(New Attachment(fuAttachment.PostedFile.InputStream, FileName))
                'End If
                mm.IsBodyHtml = False
                Dim smtp As New SmtpClient()
                smtp.Host = "relay-hosting.secureserver.net"
                smtp.EnableSsl = False

                'Dim NetworkCred As New NetworkCredential(mymail, mypass)
                'smtp.UseDefaultCredentials = False

                'smtp.Credentials = NetworkCred
                smtp.Port = 25
                smtp.Send(mm)
''' '' here notification after send
                ClientScript.RegisterStartupScript(Me.GetType, "alert", "alert('Email sent-" & mailbody & ".');", True)
            End Using

        Catch ex As Exception
           ''' lblmsg.Text = ex.Message   '' here error message
        End Try
        Return False
    End Function


''simply added this function you can send email from you domail email 
Please subscribe my blog and share if any issue then comment on this post

Comments

Popular posts from this blog

System Center 2012 FREE Product Key

Microsoft Visual Studio 2015 Pro & Enterprise,PROFESSIONAL PRODUCT Keys FREE

Ways to Make Money Online Free with mysurvey my survey