Skip to content
This repository
Newer
Older
100644 87 lines (49 sloc) 2.225 kb
1e41927b »
2011-03-14 Documentation. Woot!
1 Transaction Object
2 ==================
3
4 An SMTP transaction is valid from MAIL FROM time until RSET or "final-dot".
5
6 API
7 ---
8
e61262a6 » Matt Sergeant
2011-06-02 Re-apply doc changes
9 * transaction.uuid
10
11 A unique UUID for this transaction. Is equal to the connection.uuid + '.N'
12 where N increments for each transaction on this connection.
13
1e41927b »
2011-03-14 Documentation. Woot!
14 * transaction.mail\_from
15
44909ffe »
2011-04-29 Documentation for Body and Header parts of the mail, and updated to
16 The value of the MAIL FROM command as an `Address` object.
1e41927b »
2011-03-14 Documentation. Woot!
17
18 * transaction.rcpt\_to
19
44909ffe »
2011-04-29 Documentation for Body and Header parts of the mail, and updated to
20 An Array of `Address` objects of recipients from the RCPT TO command.
1e41927b »
2011-03-14 Documentation. Woot!
21
22 * transaction.data\_lines
23
44909ffe »
2011-04-29 Documentation for Body and Header parts of the mail, and updated to
24 An Array of the lines of the email after DATA.
1e41927b »
2011-03-14 Documentation. Woot!
25
dc2f80d7 » Matt Sergeant
2011-03-21 Added header marker and add_header methods
26 * transaction.data\_bytes
27
44909ffe »
2011-04-29 Documentation for Body and Header parts of the mail, and updated to
28 The number of bytes in the email after DATA.
dc2f80d7 » Matt Sergeant
2011-03-21 Added header marker and add_header methods
29
30 * transaction.add_data(line)
31
44909ffe »
2011-04-29 Documentation for Body and Header parts of the mail, and updated to
32 Adds a line of data to the email. Note this is RAW email - it isn't useful
33 for adding banners to the email.
dc2f80d7 » Matt Sergeant
2011-03-21 Added header marker and add_header methods
34
1e41927b »
2011-03-14 Documentation. Woot!
35 * transaction.notes
36
37 A safe place to store transaction specific values.
38
6c692535 » smfreegard
2012-05-29 Change function name and improve docs for last commit
39 * transaction.add_leading_header(key, value)
cd56e14a » smfreegard
2012-05-24 New add_trace_header function to transaction object
40
6c692535 » smfreegard
2012-05-29 Change function name and improve docs for last commit
41 Adds a header to the top of the header list. This should only be used in
42 very specific cases. Most people will want to use add_header() instead.
cd56e14a » smfreegard
2012-05-24 New add_trace_header function to transaction object
43
44909ffe »
2011-04-29 Documentation for Body and Header parts of the mail, and updated to
44 * transaction.add_header(key, value)
45
46 Adds a header to the email.
47
2f11f332 »
2011-05-02 Added remove_header to transaction and documented it.
48 * transaction.remove_header(key)
49
50 Deletes a header from the email.
51
44909ffe »
2011-04-29 Documentation for Body and Header parts of the mail, and updated to
52 * transaction.header
53
54 The header of the email. See `Header Object`.
55
56 * transaction.parse_body
57
58 Set to 1 to enable parsing of the mail body. Make sure you set this in
59 hook_data or before.
60
61 * transaction.body
62
63 The body of the email if you set `parse_body` above. See `Body Object`.
64
65 * transaction.attachment_hooks(start, data, end)
66
67 Sets event emitter hooks for attachments if you set `parse_body` above.
68
07a81009 »
2011-08-08 Allow per-attachment callbacks
69 The `start` event will receive `(content_type, filename, body)` as parameters.
44909ffe »
2011-04-29 Documentation for Body and Header parts of the mail, and updated to
70
71 The `data` event will receive a `Buffer` object containing some of the
72 attachment data.
73
74 The `end` event will be called with no parameters when an attachment ends.
75
76 Both the `data` and `end` params are optional.
07a81009 »
2011-08-08 Allow per-attachment callbacks
77
78 Note that in the `start` event, you can set per-attachment events via:
79
80 body.on('attachment_data', cb)
81 body.on('attachment_end', cb)
68fcbb85 » Matt Sergeant
2012-02-28 Bannering! Nuff said.
82
83 * transaction.set_banner(text, html)
84
85 Sets a banner to be added to the end of the email. If the html part is not
86 given (optional) then the text part will have each line ending replaced with
87 `<br/>` when being inserted into HTML parts.
Something went wrong with that request. Please try again.