1 throw new Error("Description for built in functions. Must not be included!"); 2 /** 3 * @fileOverview 4 * A class which allows to send mails through the 'mail' program 5 */ 6 7 8 /** 9 * @class 10 * 11 * This class represents an interface to the program 'mail'. 12 * 13 * To send a mail, create an instance and fill the properties 14 * (see reference) with proper data. 15 * 16 * @example 17 * var mail = new Mail("This is the subject"); 18 * 19 * // At least one recipient is mandatory 20 * mail.recipients.push("max.mustermann@musterstadt.com"); 21 * // To add several recipients 22 * mail.recipients.push("max.mustermann@musterstadt.com", "erika.mustermann@musterstadt.com"); 23 * 24 * // similar to the property recipient you can use the properties 'cc' and 'bcc' 25 * 26 * // If you want to add attachments [optional] 27 * mail.attachments.push("logfile.txt"); 28 * // or for several attachments 29 * mail.attachments.push("logfile1.txt", "logfile2.txt"); 30 * 31 * // The text of the message is set in the property text... 32 * // ...either as single string 33 * mail.text.push("This is line1\nThis is line2"); 34 * mail.text.push("This is line1"); 35 * mail.text.push("This is line2"); 36 * 37 * // Send the message 38 * mail.send(); 39 * 40 * @author <a href="mailto:thomas.bretz@epfl.ch">Thomas Bretz</a> 41 * 42 */ 43 function Mail() 44 { 45 46 /** 47 * Subject of the mail 48 * 49 * @type String 50 * @constant 51 */ 52 this.subject = subject; 53 54 /** 55 * Recipient(s) of the mail. One recipient is mandatory. 56 * 57 * @type Array[String] 58 */ 59 this.recipients = recipient; 60 61 /** 62 * Carbon copy [optional]. Adresses who should receive a copy of the 63 * mail. All entries in the array which are not a string are silently ignored. 64 * 65 * @type Array[String] 66 */ 67 this.cc = undefined; 68 69 /** 70 * Blind carbon copy [optional]. Adresses who should receive a copy of the 71 * mail. All entries in the array which are not a string are silently ignored. 72 * 73 * @type Array[String] 74 */ 75 this.bcc = undefined; 76 77 /** 78 * Attachments [optional]. File to be attached to the mail. 79 * All entries in the array which are not a string are silently ignored. 80 * 81 * @type Array[String] 82 */ 83 this.attachments = undefined; 84 85 /** 86 * Message body. At least one line in the message is mandatory. 87 * Undefined or null entries in the array are silently ignored. 88 * 89 * @type Array[String] 90 */ 91 this.text = text; 92 93 /** 94 * Send the message. This calles the 'mailx' program. For further 95 * details, e.g. on the return value, see the corresponding man page. 96 * 97 * @param {Boolean} [block=true] 98 * This parameter specifies whether the pipe should be closed, 99 * which means that a blocking wait is performed until the 'mail' 100 * program returns, or the pipe will be closed automatically 101 * in the background when the 'mail' program has finished. 102 * Note, that if the calling program terminates, maybe this 103 * call will never succeed. 104 * 105 * @returns {Integer} 106 * The return code of the 'mail' program is returned (0 107 * usually means success), undefined if block was set to false. 108 * 109 * @throws 110 * An exception is thrown if any validity check for the 111 * properties or the arguments fail. 112 * 113 */ 114 this.send = function() { /* [native code] */ } 115 } 116