DLG_IEMAIL Dialog Component
Purpose
The Validate event of the dialog sends an email using the EMAIL_SEND() function.
Description
The DLG_IEMAIL dialog component contains four text box controls and a text area control. The Send To, CC, and BCC controls support lookups of the firstname, lastname, and email fields of the customer table.
Container
Notable Grid Control Property Settings
Control |
Property |
Description |
sendto |
Control Settings > Control type |
Set to "Textbox" |
Control Settings > Validation rules |
General > Enable rules set to TRUE. General > Require value set to TRUE. General > Custom error message set to " Send To Email Address is Required ". | |
Lookup > Lookup Definition |
Lookup Window > Grid name is GRD_CUSTEMAIL Field Mapping > Field map copies the Email field to Sendto. | |
cc |
Control Settings > Control type |
Set to "Textbox" |
Control Settings > Validation rules |
General > Enable rules set to TRUE. | |
Lookup > Lookup Definition |
Lookup Window > Grid name is GRD_CUSTEMAIL Field Mapping > Field map copies the Email field to cc. | |
bcc |
Control Settings > Control type |
Set to "Textbox" |
Control Settings > Validation rules |
General > Enable rules set to TRUE. | |
Lookup > Lookup Definition |
Lookup Window > Grid name is GRD_CUSTEMAIL Field Mapping > Field map copies the Email field to bcc. | |
subject |
Control Settings > Control type |
Set to "Textbox" |
Control Settings > Validation rules |
General > Enable rules set to TRUE. General > Require value set to TRUE. General > Custom error message set to " Subject Line is Required ". | |
body |
Control Settings > Control type |
Set to "Textarea" |
Notable Component Property Settings
Property |
Description |
Submit/Reset Buttons > Submit button label |
Changed from "Submit" to "Send" |
Submit/Reset Buttons > Reset button label |
Changed from "Reset" to "Clear" |
Event Code
This code was placed under the Server Events > Validate property. The script cancels the email send if the user does not have an email profile.
if email_profile_valid() = .F. CurrentForm.Has_Error = .T. CurrentForm.Error_Message = " Email Profile Not Defined" end if |
This code was placed under the Server Events > AfterValidate property. If the email send was unsuccessful, it returns an error. Otherwise, it erases the form's field in readiness for another email.
if email_send(CurrentForm.Controls.sendto, CurrentForm.Controls.subject, CurrentForm.Controls.body, "", CurrentForm.Controls.cc, CurrentForm.Controls.bcc) = 0 'not sent CurrentForm.Has_Error = .T. CurrentForm.Error_Message = " Error: Email Not Sent" else CurrentForm.Controls.sendto = "" CurrentForm.Controls.cc = "" CurrentForm.Controls.bcc = "" CurrentForm.Controls.subject = "" CurrentForm.Controls.body = "" end if |
See Also
Supported By
Alpha Five Version 7 and Above