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("firstname.lastname@example.org", "Michelle Solis")
Msg.To.Add(New MailAddress("email@example.com", "Michelle Solis"))
Msg.IsBodyHtml = CBool("False")
Msg.Body = "this is the email body"
Msg.Subject = "this is the subject"
Catch ex As Exception
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 objRecipient.Resolve 'Send the message. objMessage.Send showDialog:=False MsgBox "Message sent successfully!" 'Logoff using the session object. objSession.Logoff End Sub
|Tags: email, microsoft, visual basic, visual studio, winodows xp|
|Thread Tools||Search this Thread|
|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|