I’m attempting to write a global method that will serve as a general method (a wrapper) to send emails via our solution.
I’m pretty new to writing methods, so I thought that I would start this topic to track my progress as well give me a place to ask for help.
I’m planning on using the Mail plugin.
–
Here’s what we need:
- We want the method to open a new message for editing in the default email client on the user’s computer.
I’ve already found this HOWTO, but haven’t tried it yet:
http://forum.servoy.com/viewtopic.php?p=3110#3110
- The email, once opened in the user’s email client and ready for editing, will be prepopulated with some or all of the pertinent information that will be sent in the email. This may include any or all of the following:
from_address
to_address(es)
cc_address(es)
bcc_address(es)
subject
message text (can be html formatted if it starts with the tag)
attachment(s)
–
Here’s what I’ve done so far:
-
Created a new global method, sendEmail
-
Briefly declared my variables:
var to_address = new Array();
var from_address;
var subject;
var msgText; //can be html if you start with an <html> tag.
var cc_address = new Array();
var bcc_address = new Array();
var attachments = new Array();
- Moved over sample code from the sendMail method of the Mail plugin.
–
My first question is about the format of the method. I would like to make it so that when people think about using this method, they can quickly see what properties need to be declared, and in what order (order matters, right?).
My second question is about the arrays. If more than one to_address is the array, how do I pass this to Mail’s sendMail method?
–
Thanks for any help, comments, or suggestions.