Go Back   TechArena Community > General Discussion > Off Topic Chat
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links

how to send email in vb

Off Topic Chat

Thread Tools Search this Thread
Old 20-04-2011
Join Date: Apr 2011
Posts: 1
how to send email in vb

i need to know how to code sending email when customers create an account, place an order, and change their password. how would i do that in vb. this is a homework assignment and the code i used already works but i need to implement when customers do those three things and send an email that they have created an account, placed an order, and changed their password. how would i do that in this code?

Dim Msg As MailMessage = New MailMessage()
Dim MailObj As New SmtpClient("smtp.mccombs.utexas.edu")
Msg.From = New MailAddress("littlemic14@yahoo.com", "Michelle Solis")
Msg.To.Add(New MailAddress("michelle.solis@bba07.mccombs.utexas.edu", "Michelle Solis"))
Msg.IsBodyHtml = CBool("False")
Msg.Body = "this is the email body"
Msg.Subject = "this is the subject"
Catch ex As Exception
End Try

End Sub

Reply With Quote
Old 20-04-2011
Join Date: Feb 2011
Posts: 117
Re: how to send email in vb

Well I want you to just try out the bellow code and see to it whether it helps you or not :

 Option Explicit

     Private Sub Command1_Click()
       Dim objSession As Object
       Dim objMessage As Object
       Dim objRecipient As Object

       'Create the Session Object.
       Set objSession = CreateObject("mapi.session")

       'Logon using the session object.
       'Specify a valid profile name if you want to.
       'Avoid the logon dialog box.
       objSession.Logon profileName:="MS Exchange Settings"

       'Add a new message object to the OutBox.
       Set objMessage = objSession.Outbox.Messages.Add

       'Set the properties of the message object.
       objMessage.subject = "This is a test."
       objMessage.Text = "This is the message text."

        'Add a recipient object to the objMessage.Recipients collection.
       Set objRecipient = objMessage.Recipients.Add

       'Set the properties of the recipient object.
       objRecipient.Name = "John Doe"  '<---Replace this with a valid
                                       'display name or e-mail alias
       'Type can be ActMsgTo, mapiTo, or CdoTo for different CDO versions;
       'they all have a constant value of 1.
       objRecipient.Type = mapiTo

       'Send the message.
       objMessage.Send showDialog:=False
       MsgBox "Message sent successfully!"

       'Logoff using the session object.
     End Sub
And if you want to get more information on the same then you can click here
Reply With Quote

  TechArena Community > General Discussion > Off Topic Chat
Tags: , , , ,

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads for: "how to send email in vb"
Thread Thread Starter Forum Replies Last Post
Unable to send email with jpeg's/mp3's attachment to a Verizon phone using Opera's email client Tawannah Technology & Internet 4 23-08-2011 08:04 AM
Unable to send email from email alias via Microsoft Office 365 FrancoL Windows Software 6 10-07-2011 08:26 PM
"send page by email" and "send link by email" disabled in Internet Explorer 8 Bindaas-ER Technology & Internet 4 27-02-2011 03:32 AM
Windows live mail couldn't send email but can receive email danielyen Windows Software 1 15-07-2010 12:17 AM
Cannot send internal email to a external email host like hotmail, gmail, yahoo, gmx etc... Antonio00 Small Business Server 2 14-02-2008 08:16 PM

All times are GMT +5.5. The time now is 04:54 AM.