send email through SMTP in

 Imports System.Net
Imports System.IO
Imports System.Net.Mail

Following is the Code

  Private Function SendEmail(ByVal mailfrom As String, ByVal mailto As String, ByVal cc As String, ByVal bcc As String, ByVal subject As String, ByVal message As String, ByVal attach1 As String, ByVal attach2 As String, ByVal userid As String, ByVal pwd As String) As String
            'create the mail message
            Dim mail As New MailMessage()

            'set the addresses
            mail.From = New MailAddress(mailfrom)

            'set the content
            mail.IsBodyHtml = True
            mail.Subject = subject
            mail.Body = message

            ' add an attachment from the filesystem
            mail.Attachments.Add(New Attachment(attach1))

            'to add additional attachments, simply call .Add(...) again
            '  mail.Attachments.Add(New Attachment(attach2))
            ' mail.Attachments.Add(New Attachment("c:\temp\example3.txt"))

            'send the message
            Dim mailClient As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient()
            Dim d As New dbOperation
            'This object stores the authentication values
            Dim basicCredential As System.Net.NetworkCredential = New System.Net.NetworkCredential("", "pwd")
            mailClient.Host = ""
            mailClient.UseDefaultCredentials = False
            mailClient.Credentials = basicCredential
            Return "ok"
        Catch exp As Exception

            Return "Error: " & exp.Message
        End Try


Most Viewed Post

solution for facebook waiting

Connect Sony XPLOD MEX-BT2500 Bluetooth CD Receiver with ur mobile

Crystal Report : Show data horizontally (Left to right) i.e. columns as rows