| 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.pus("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 Sky()
|
|---|
| 44 | {
|
|---|
| 45 |
|
|---|
| 46 | /**
|
|---|
| 47 | * Subject of the mail
|
|---|
| 48 | *
|
|---|
| 49 | * @type String
|
|---|
| 50 | */
|
|---|
| 51 | this.subject = subject;
|
|---|
| 52 |
|
|---|
| 53 | /**
|
|---|
| 54 | * Recipient(s) of the mail. One recipient is mandatory.
|
|---|
| 55 | *
|
|---|
| 56 | * @type Array[String]
|
|---|
| 57 | */
|
|---|
| 58 | this.recipients = recipient;
|
|---|
| 59 |
|
|---|
| 60 | /**
|
|---|
| 61 | * Carbon copy [optional]. Adresses who should receive a copy of the
|
|---|
| 62 | * mail. All entries in the array which are not a string are silently ignored.
|
|---|
| 63 | *
|
|---|
| 64 | * @type Array[String]
|
|---|
| 65 | */
|
|---|
| 66 | this.cc = undefined;
|
|---|
| 67 |
|
|---|
| 68 | /**
|
|---|
| 69 | * Blind carbon copy [optional]. Adresses who should receive a copy of the
|
|---|
| 70 | * mail. All entries in the array which are not a string are silently ignored.
|
|---|
| 71 | *
|
|---|
| 72 | * @type Array[String]
|
|---|
| 73 | */
|
|---|
| 74 | this.bcc = undefined;
|
|---|
| 75 |
|
|---|
| 76 | /**
|
|---|
| 77 | * Attachments [optional]. File to be attached to the mail.
|
|---|
| 78 | * All entries in the array which are not a string are silently ignored.
|
|---|
| 79 | *
|
|---|
| 80 | * @type Array[String]
|
|---|
| 81 | */
|
|---|
| 82 | this.attachments = undefined;
|
|---|
| 83 |
|
|---|
| 84 | /**
|
|---|
| 85 | * Message body. At least one line in the message is mandatory.
|
|---|
| 86 | * Undefined or null entries in the array are silently ignored.
|
|---|
| 87 | *
|
|---|
| 88 | * @type Array[String]
|
|---|
| 89 | */
|
|---|
| 90 | this.text = text;
|
|---|
| 91 |
|
|---|
| 92 | /**
|
|---|
| 93 | * Send the message. This calles the 'mailx' program. For further
|
|---|
| 94 | * details, e.g. on the return value, see the corresponding man page.
|
|---|
| 95 | *
|
|---|
| 96 | * @param {Boolean} [block=true]
|
|---|
| 97 | * This parameter specifies whether the pipe should be closed,
|
|---|
| 98 | * which means that a blocking wait is performed until the 'mail'
|
|---|
| 99 | * program returns, or the pipe will be closed automatically
|
|---|
| 100 | * in the background when the 'mail' program has finished.
|
|---|
| 101 | * Note, that if the calling program terminates, maybe this
|
|---|
| 102 | * call will never succeed.
|
|---|
| 103 | *
|
|---|
| 104 | * @returns {Integer}
|
|---|
| 105 | * The return code of the 'mail' program is returned (0
|
|---|
| 106 | * usually means success), undefined if block was set to false.
|
|---|
| 107 | *
|
|---|
| 108 | * @throws
|
|---|
| 109 | * An exception is thrown if any validity check for the
|
|---|
| 110 | * properties or the arguments fail.
|
|---|
| 111 | *
|
|---|
| 112 | */
|
|---|
| 113 | this.send = function() { /* [native code] */ }
|
|---|
| 114 | }
|
|---|