Developer Interface
exceptions
SpoolError
Base class for exceptions.
mailer
Mailer
Represents an SMTP connection.
dump(msg)
staticmethod
Print a message to console.
Prints a given message to console in Internet Message Format (IMF).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
msg |
|
A message. |
required |
Source code in spool/mailer.py
185 186 187 188 189 190 191 192 193 194 195 |
|
get_helo_name()
staticmethod
Retrive the helo/ehlo name based on the hostname.
Source code in spool/mailer.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|
send(self, msg, print_only=True)
Send a message.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
msg |
|
The message to send (or print to console) |
required |
print_only |
|
obj: |
True |
Source code in spool/mailer.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
|
MailerError
Base class for all errors related to the mailer.
RemoteNotFoundError
Remote server could not be evaluated.
main
cli()
Main cli entry point.
Source code in spool/main.py
203 204 205 206 207 208 209 210 211 212 213 214 |
|
parse_args(args)
Parse command line arguments.
Source code in spool/main.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
|
run()
Main method.
Source code in spool/main.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
|
tags_matches_mail(tags, mail)
Returns True if mail has a matching tag.
Source code in spool/main.py
100 101 102 103 104 105 106 107 108 |
|
message
EmailHeaders
Case insensitive dictionary to store email headers.
Copied from Requests CaseInsensitiveDict.
.._ Requests:
https://requests.readthedocs.io
Message
Represents a single email message.
headers
property
readonly
Get the message headers.
as_string(self)
Return the entire message flattened as a string.
Returns:
Type | Description |
---|---|
str |
The message as Internet Message Format (IMF) formatted string. |
Source code in spool/message.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
|
attach(self, file_path)
Add file to message attachments.
Adds a given path to the set of files which are appended to
the generated message when the method as_string
is called.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
str |
relative or absolute path to the file. |
required |
Source code in spool/message.py
168 169 170 171 172 173 174 175 176 177 178 |
|
MessageError
Base class for message related errors.
parse_addrs(addrs)
Parses a comma separated string to list of email addresses.
Wrapper arround pythons email.utils.parseaddr
function to parse a
comma separated list of email addresses.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
addrs |
|
Comma separated string or list of email addresses to parse |
required |
Returns:
Type | Description |
---|---|
list |
A list of tuples consiting of realname and email address parts |
Examples:
1 2 3 4 |
|
Source code in spool/message.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
parser
Config
Represents a single mail instance config.
load(config)
staticmethod
Create a config object from a config file.
Source code in spool/parser.py
163 164 165 166 167 168 169 170 171 |
|
ConfigError
Base class for all parsing errors.
ValidationError
Validation Error.
to_list(string)
Returns a list of values from a comma separated string
Source code in spool/parser.py
12 13 14 15 16 17 18 |
|
smime
encode_cms(mime_part)
Encodes a cms structure
Source code in spool/smime.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
|
encrypt(message, certs, algorithm='des3')
Encrypt a given message.
Source code in spool/smime.py
85 86 87 88 89 90 91 92 93 94 95 |
|
parse_pem(certstack)
Extract PEM strings from certstack.
Source code in spool/smime.py
23 24 25 26 27 28 29 30 31 |
|
sign(message, key, cert, detached=True)
Sign a a given message.
Source code in spool/smime.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
|