Link to home
Start Free TrialLog in
Avatar of chrisryhal
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
Avatar of BrianGEFF719
BrianGEFF719
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
BTW, that control is free aslong as you dont sell your software, and even if you do it only costs $19
Avatar of davidkroiter
davidkroiter

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
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.