I would like to send an email from a Mongoose application by using a FormScript method.Is there a library that can be used to generate and send emails programmatically?
I'm using the Cloud version of Mongoose.
Thanks!
This is how I've sent emails from Form Script. I hope this helps.
Here is an example of the Form Script method. The formatted was lost when I pasted it here.
public void BuildUpdateEmail(string rowPointer) { var title = ThisForm.PrimaryIDOCollection.GetCurrentObjectProperty("Title"); var assignedTo = ThisForm.PrimaryIDOCollection.GetCurrentObjectProperty("AssignedToFullName"); var comments = ThisForm.PrimaryIDOCollection.GetCurrentObjectProperty("CommentsToRequestor"); var requestorEmail = ThisForm.PrimaryIDOCollection.GetCurrentObjectProperty("RequestorEmail"); System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("<b>Title: </b> " + title + " <br/><br/>"); sb.Append("<b>Comments to Requestor: </b> <br/>"); sb.Append(comments + " <br/> <br/>"); sb.Append("<div> </div>"); sb.Append("---Do Not Reply to this email. If you need to communicate with the building services team, please forward this email to buildingservices@XXXX.org"); sb.Append("<div> </div>"); var formURL = ReadConfiguration("BuildingServices", "Form URL"); var url = formURL + rowPointer + "))"; var link = "<a href="" + url + "">Building Services Request Form</a>"; sb.Append(link); string emailMessage = sb.ToString();
ThisForm.Variables("vEmailMessage").SetValue(emailMessage); ThisForm.Variables("vEmailSubject").SetValue("Comments Updated on Building Services Request"); ThisForm.Variables("vEmailTo").SetValue(requestorEmail); ThisForm.GenerateEvent("SendEmail"); }
Here is the event to send the email.
Click to expand.
The other 2 parameters.
Thanks Terry for the quick answer!
It looks like you are calling a custom method to get the 'formURL':
var formURL = ReadConfiguration("BuildingServices", "Form URL");
Can you please help me if this is a custom method or am I missing a using directive from the beginning of the code?
Kind regards,
Robert
That is a custom method. We put a link to the form in the email. We have a custom IDO that stores configuration information. You can skip these lines from my example.
var formURL = ReadConfiguration("BuildingServices", "Form URL");var url = formURL + rowPointer + "))";var link = "<a href="" + url + "">Building Services Request Form</a>";sb.Append(link);
I see, thank you!
Hey Terry,
We are building an invoice approval application. In the app we can have multiple invoices to choose from on the left side of the application, and on the right side you can see the details of the selected row.
In the email what we would like to send to the approver we also want to provide a link back to the selected invoice line, so they can check the details and approve that line.
It looks like you are concatenating similar URL back to the form in the code above. Can you please tell me more details about these URLs? How can I concatenate a URL that loads the form, and loads the information of the selected row on the right side? (I hope it makes sense)
Regards,