Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB
Hai guys,

I need to send email though vb using gmail smtp.
But i really dont want to use any 3rd party components.
Pls give me a pure vb6 solution.

* Previously i have not used emailing though vb.
Posted 30-Aug-08 21:55pm
afridy148
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You can just connect to the SMTP server directly and send the necessary commands. However, GMail requires a connection over SSL.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Imports System.Net.Mail
 

'inside some required event
 
Dim mail As New MailMessage()
Dim SmtpServer As New SmtpClient()
SmtpServer.Credentials = New Net.NetworkCredential("Your gmail id", "your gmail password")
SmtpServer.Port = 587
SmtpServer.Host = "smtp.gmail.com"
SmtpServer.EnableSsl = True
mail = New MailMessage()
Try
mail.From = New MailAddress("ur gmail id", "some text", System.Text.Encoding.UTF8)
mail.To.Add(" reciepient mail id")
mail.Subject = "ur subject here"
mail.Body = "ur mail body"
mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure
mail.ReplyTo = New MailAddress("reciepient mail id")
SmtpServer.Send(mail)
MessageBox.Show("mail sent")
Catch ex As Exception
MsgBox(ex.ToString())
End Try
  Permalink  
  Print Answers RSS
0 Sergey Alexandrovich Kryukov 359
1 Richard MacCutchan 320
2 OriginalGriff 280
3 Jared Sanow 145
4 Snehasish_Nandy 115
0 Sergey Alexandrovich Kryukov 5,939
1 OriginalGriff 4,885
2 CPallini 2,473
3 Abhinav S 1,507
4 Richard MacCutchan 1,437


Advertise | Privacy | Mobile
Web02 | 2.8.140814.1 | Last Updated 26 Sep 2010
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100