My users submit an application via one of my Dialogs, and I wanted to send them an email stating that their application was received. Here is the solution that fits my needs and if it will help you too then I've accomplished my goal. I'm using Gmail as my relay, but you can easily change what you need here. Note that items in BLUE are the names of Dialog controls that hold user entered data.
Syntax: (email_smtp_open(ps, "SMTP ADDRESS",PORT,"USERNAME","PASSWORD","AUTHENTICATION"))
Sending Email via Dialog (A5v11)
Server Side Code
***********************************************************
function afterDialogValidate as v (e as p)
'--Submit Data--
ExecuteServerSideAction("Save Data::Save_Submitted_Data_to_Table_s_")
'--Send Email--
dim pm as P
dim ps as P
dim msubject as C
dim recipient as C = e.datasubmitted.user_name
dim fn as C = e.datasubmitted.add_fname
dim ln as C = e.datasubmitted.add_lname
dim msg as C = "Your application has been received and will be processed shortly."
IF (email_smtp_open(ps, "smtp.gmail.com",465,"EmailUserName","EmailPassword","SSL")) THEN
With pm
.to = recipient
.from = "[email protected]"
.cc = ""
.bcc = "[email protected]"
.subject = "Thank you for your application."
.message = "Dear " + fn + " " + ln + "," +(chr(10)) + (chr(10)) + msg
.autowrap = .T.
End With
email_smtp_send(pm, ps)
END IF
email_smtp_close(ps)
end function
***********************************************************
Syntax: (email_smtp_open(ps, "SMTP ADDRESS",PORT,"USERNAME","PASSWORD","AUTHENTICATION"))
Sending Email via Dialog (A5v11)
Server Side Code
***********************************************************
function afterDialogValidate as v (e as p)
'--Submit Data--
ExecuteServerSideAction("Save Data::Save_Submitted_Data_to_Table_s_")
'--Send Email--
dim pm as P
dim ps as P
dim msubject as C
dim recipient as C = e.datasubmitted.user_name
dim fn as C = e.datasubmitted.add_fname
dim ln as C = e.datasubmitted.add_lname
dim msg as C = "Your application has been received and will be processed shortly."
IF (email_smtp_open(ps, "smtp.gmail.com",465,"EmailUserName","EmailPassword","SSL")) THEN
With pm
.to = recipient
.from = "[email protected]"
.cc = ""
.bcc = "[email protected]"
.subject = "Thank you for your application."
.message = "Dear " + fn + " " + ln + "," +(chr(10)) + (chr(10)) + msg
.autowrap = .T.
End With
email_smtp_send(pm, ps)
END IF
email_smtp_close(ps)
end function
***********************************************************