Send email with new data action allows sending an email containing information about new data in the table.
You can edit several parameters: the text and the subject of the message, the sender and recipient email addresses.
Available in the following events:
•Add page: Before record added
•Edit page: Before record updated
•Edit page: After record updated
Note: To use this action, you have to set up the Email settings. Press button on the toolbar or write the code manually.
'********** Send email with new data (VB) ************
Dim email = "test@test.com"
Dim from = "admin@test.com"
Dim msg = New StringBuilder("")
Dim subject = "New data record"
For Each field In values.GetEnumerator()
If Not CType(CommonFunctions.IsBinaryType(pageObject.pSet.getFieldType(field.Key)), Boolean) Then
msg.Append(field.Key.ToString() & " : " & field.Value.ToString() & Environment.NewLine)
End If
Next
Dim ret = MVCFunctions.runner_mail(New XVar("to", email, "subject", subject, "body", msg.ToString(), "from", from))
If Not CType(ret("mailed"), Boolean) Then
MVCFunctions.Echo(ret("message"))
End If
//********** Send email with new data (C#) ************
string email = "test@test.com";
string from = "admin@test.com";
StringBuilder msg = new StringBuilder("");
string subject = "New data record";
foreach(var field in values.GetEnumerator())
{
if(!CommonFunctions.IsBinaryType(pageObject.pSet.getFieldType(field.Key)))
{
msg.Append(field.Key.ToString() + " : " + field.Value.ToString() + "\r\n");
}
}
XVar ret = MVCFunctions.runner_mail(new XVar("to", email, "subject", subject, "body", msg.ToString(), "from", from));
if(!ret["mailed"])
{
MVCFunctions.Echo(ret["message"]);
}
See also:
•Send an email to selected users
•How to email selected records as separate PDF files