chrisryhal
asked on
SMTP Submission via a checkbox
I need a form, that contacts a check box, that when checked, prompts the user "Do you want to send an alert?" and if they say "Yes" sends the email out to a hardcoded email address within the code using SMTP. Can someone please help me out with this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
BTW, that control is free aslong as you dont sell your software, and even if you do it only costs $19
You can just reference your project with Microsoft Outlook then use the following commands:
Private mobjOut As Outlook.Application
Private Sub mychkbox_click()
Call Send(email@address.com, "FirstNameofRecepient")
End Sub
Sub Send(sEmail As String, sFirstName As String)
Dim obj As Outlook.MailItem
Dim HTMLDetail As String
HTMLDetail="This is what I went the alert to say"
obj.HTMLBody = HTMLDetail
obj.To = sEmail
obj.Subject = "My Emails subject"
obj.Send
End Sub
Private mobjOut As Outlook.Application
Private Sub mychkbox_click()
Call Send(email@address.com, "FirstNameofRecepient")
End Sub
Sub Send(sEmail As String, sFirstName As String)
Dim obj As Outlook.MailItem
Dim HTMLDetail As String
HTMLDetail="This is what I went the alert to say"
obj.HTMLBody = HTMLDetail
obj.To = sEmail
obj.Subject = "My Emails subject"
obj.Send
End Sub
You would probably want your checkbox code to be more like this:
Private Sub mychkbox_click()
If mychkbox.value=true then
response=msgbox ("Do you want to send an alert?", vbQuestion + vbYesNo, "Send Alert?")
if response=vbNo then exit sub
Call Send(email@address.com, "FirstNameofRecepient")
End if
End Sub
Or something to that effect.
Private Sub mychkbox_click()
If mychkbox.value=true then
response=msgbox ("Do you want to send an alert?", vbQuestion + vbYesNo, "Send Alert?")
if response=vbNo then exit sub
Call Send(email@address.com, "FirstNameofRecepient")
End if
End Sub
Or something to that effect.