Simple Gmail Client in

sandeepparekh9 0 Tallied Votes 431 Views Share

hi.. guys.. just joined daniweb.. and this is my first post

this one's very easy... i suffered a lot to find this simple program.. i hope you guys like it..

here is a quick preview of it...

1. First Of All Add the Following Line to your code:

Imports System.Net.Mail

2. Now As Show in the image create the basic layout of the application.

3. Enter you Gmail's user id and pass in the required filed

4. the TO,Subject,Body text box are easily explainable...

5. define the following's

Dim msg As New MailMessage
    Dim i As Integer

6. Now is the Main coding for Send Button.. here it is

        msg.From = New MailAddress(Me.txtuser.Text)
        msg.Subject = Me.txtsubject.Text
        msg.Body = Me.txtbody.Text
        'msg.Attachments.Add(New Attachment(Me.txtattach.Text))
        '' for attachment

        For i = 0 To Me.ListBox1.Items.Count - 1
            msg.Attachments.Add(New Attachment(Me.ListBox1.Items(i).ToString))

        Dim smtp As New SmtpClient
        smtp.Host = ""
        smtp.EnableSsl = True
        smtp.Port = 587
        smtp.Credentials = New Net.NetworkCredential(Me.txtuser.Text, Me.txtpass.Text)

7. Let's see the coding for the attachment button...

Dim d As New OpenFileDialog
        Me.ListBox1.Visible = True

8. well its done ... easy ..

Vineeth K 10 Posting Whiz in Training

thanks man, this one is really simple one i really liked it ...

kothaisaravan 0 Light Poster

Hi I got error message with this code "Failure Sending Mail" with SMTP Excxeption.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.