Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 88 lines (49 sloc) 2.225 kb
1e41927 Matt Sergeant Documentation. Woot!
authored
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
e61262a Re-apply doc changes
Matt Sergeant authored
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
1e41927 Matt Sergeant Documentation. Woot!
authored
14 * transaction.mail\_from
15
44909ff Matt Sergeant Documentation for Body and Header parts of the mail, and updated to
authored
16 The value of the MAIL FROM command as an `Address` object.
1e41927 Matt Sergeant Documentation. Woot!
authored
17
18 * transaction.rcpt\_to
19
44909ff Matt Sergeant Documentation for Body and Header parts of the mail, and updated to
authored
20 An Array of `Address` objects of recipients from the RCPT TO command.
1e41927 Matt Sergeant Documentation. Woot!
authored
21
22 * transaction.data\_lines
23
44909ff Matt Sergeant Documentation for Body and Header parts of the mail, and updated to
authored
24 An Array of the lines of the email after DATA.
1e41927 Matt Sergeant Documentation. Woot!
authored
25
dc2f80d Added header marker and add_header methods
Matt Sergeant authored
26 * transaction.data\_bytes
27
44909ff Matt Sergeant Documentation for Body and Header parts of the mail, and updated to
authored
28 The number of bytes in the email after DATA.
dc2f80d Added header marker and add_header methods
Matt Sergeant authored
29
30 * transaction.add_data(line)
31
44909ff Matt Sergeant Documentation for Body and Header parts of the mail, and updated to
authored
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.
dc2f80d Added header marker and add_header methods
Matt Sergeant authored
34
1e41927 Matt Sergeant Documentation. Woot!
authored
35 * transaction.notes
36
37 A safe place to store transaction specific values.
38
6c69253 Steve Freegard Change function name and improve docs for last commit
smfreegard authored
39 * transaction.add_leading_header(key, value)
cd56e14 Steve Freegard New add_trace_header function to transaction object
smfreegard authored
40
6c69253 Steve Freegard Change function name and improve docs for last commit
smfreegard authored
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.
cd56e14 Steve Freegard New add_trace_header function to transaction object
smfreegard authored
43
44909ff Matt Sergeant Documentation for Body and Header parts of the mail, and updated to
authored
44 * transaction.add_header(key, value)
45
46 Adds a header to the email.
47
2f11f33 Matt Sergeant Added remove_header to transaction and documented it.
authored
48 * transaction.remove_header(key)
49
50 Deletes a header from the email.
51
44909ff Matt Sergeant Documentation for Body and Header parts of the mail, and updated to
authored
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
07a8100 Matt Sergeant Allow per-attachment callbacks
authored
69 The `start` event will receive `(content_type, filename, body)` as parameters.
44909ff Matt Sergeant Documentation for Body and Header parts of the mail, and updated to
authored
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.
07a8100 Matt Sergeant Allow per-attachment callbacks
authored
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)
68fcbb8 Bannering! Nuff said.
Matt Sergeant authored
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.