Miscellaneous functions for sending an email. More...
Go to the source code of this file.
Macros | |
#define | MUTT_RANDTAG_LEN 16 |
Functions | |
int | mutt_bounce_message (FILE *fp, struct Mailbox *m, struct Email *e, struct AddressList *to, struct ConfigSubset *sub) |
Bounce an email message. | |
const char * | mutt_fqdn (bool may_hide_host, const struct ConfigSubset *sub) |
Get the Fully-Qualified Domain Name. | |
char * | mutt_gen_msgid (void) |
Generate a random Message ID. | |
enum ContentType | mutt_lookup_mime_type (struct Body *b, const char *path) |
Find the MIME type for an attachment. | |
struct Body * | mutt_make_file_attach (const char *path, struct ConfigSubset *sub) |
Create a file attachment. | |
struct Body * | mutt_make_message_attach (struct Mailbox *m, struct Email *e, bool attach_msg, struct ConfigSubset *sub) |
Create a message attachment. | |
void | mutt_message_to_7bit (struct Body *b, FILE *fp, struct ConfigSubset *sub) |
Convert an email's MIME parts to 7-bit. | |
void | mutt_prepare_envelope (struct Envelope *env, bool final, struct ConfigSubset *sub) |
Prepare an email header. | |
void | mutt_stamp_attachment (struct Body *b) |
Timestamp an Attachment. | |
void | mutt_unprepare_envelope (struct Envelope *env) |
Undo the encodings of mutt_prepare_envelope() | |
void | mutt_update_encoding (struct Body *b, struct ConfigSubset *sub) |
Update the encoding type. | |
int | mutt_write_fcc (const char *path, struct Email *e, const char *msgid, bool post, const char *fcc, char **finalpath, struct ConfigSubset *sub) |
Write email to FCC mailbox. | |
int | mutt_write_multiple_fcc (const char *path, struct Email *e, const char *msgid, bool post, char *fcc, char **finalpath, struct ConfigSubset *sub) |
Handle FCC with multiple, comma separated entries. | |
Miscellaneous functions for sending an email.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file sendlib.h.
int mutt_bounce_message | ( | FILE * | fp, |
struct Mailbox * | m, | ||
struct Email * | e, | ||
struct AddressList * | to, | ||
struct ConfigSubset * | sub | ||
) |
Bounce an email message.
0 | Success |
-1 | Failure |
Definition at line 917 of file sendlib.c.
const char * mutt_fqdn | ( | bool | may_hide_host, |
const struct ConfigSubset * | sub | ||
) |
Get the Fully-Qualified Domain Name.
may_hide_host | If true, hide the hostname (leaving just the domain) |
sub | Config Subset |
ptr | string pointer into Hostname |
NULL | Error, e.g no Hostname |
Definition at line 707 of file sendlib.c.
char * mutt_gen_msgid | ( | void | ) |
Generate a random Message ID.
ptr | Message ID |
The length of the message id is chosen such that it is maximal and fits in the recommended 78 character line length for the headers Message-ID:, References:, and In-Reply-To:, this leads to 62 available characters (excluding @
and >
). Since we choose from 32 letters, we have 32^62 = 2^310 different message ids.
Examples:
The distribution of the characters to left-of-@ and right-of-@ was arbitrary. The choice was made to put more into the left-id and shorten the right-id to slightly mimic a common length domain name.
Definition at line 753 of file sendlib.c.
enum ContentType mutt_lookup_mime_type | ( | struct Body * | b, |
const char * | path | ||
) |
Find the MIME type for an attachment.
b | Email with attachment |
path | Path to attachment |
enum | ContentType, e.g. TYPE_IMAGE |
Given a file at 'path', see if there is a registered MIME type. Returns the major MIME type, and copies the subtype to "d". First look in a system mime.types if we can find one, then look for ~/.mime.types. The longest match is used so that we can match 'ps.gz' when 'gz' also exists.
Definition at line 76 of file sendlib.c.
struct Body * mutt_make_file_attach | ( | const char * | path, |
struct ConfigSubset * | sub | ||
) |
Create a file attachment.
path | File to attach |
sub | Config Subset |
ptr | Newly allocated Body |
NULL | Error |
Definition at line 607 of file sendlib.c.
struct Body * mutt_make_message_attach | ( | struct Mailbox * | m, |
struct Email * | e, | ||
bool | attach_msg, | ||
struct ConfigSubset * | sub | ||
) |
Create a message attachment.
ptr | Newly allocated Body |
NULL | Error |
Definition at line 454 of file sendlib.c.
void mutt_message_to_7bit | ( | struct Body * | b, |
FILE * | fp, | ||
struct ConfigSubset * | sub | ||
) |
Convert an email's MIME parts to 7-bit.
b | Body of the email |
fp | File to read (OPTIONAL) |
sub | Config Subset |
Definition at line 259 of file sendlib.c.
void mutt_prepare_envelope | ( | struct Envelope * | env, |
bool | final, | ||
struct ConfigSubset * | sub | ||
) |
Prepare an email header.
env | Envelope to prepare |
final | true if this email is going to be sent (not postponed) |
sub | Config Subset |
Encode all the headers prior to sending the email.
For postponing (!final) do the necessary encodings only
Definition at line 780 of file sendlib.c.
void mutt_stamp_attachment | ( | struct Body * | b | ) |
Timestamp an Attachment.
b | Attachment |
Definition at line 410 of file sendlib.c.
void mutt_unprepare_envelope | ( | struct Envelope * | env | ) |
Undo the encodings of mutt_prepare_envelope()
env | Envelope to unprepare |
Decode all the headers of an email, e.g. when the sending failed or was aborted.
Definition at line 819 of file sendlib.c.
void mutt_update_encoding | ( | struct Body * | b, |
struct ConfigSubset * | sub | ||
) |
Update the encoding type.
b | Body to update |
sub | Config Subset |
Assumes called from send mode where Body->filename points to actual file
Definition at line 422 of file sendlib.c.
int mutt_write_fcc | ( | const char * | path, |
struct Email * | e, | ||
const char * | msgid, | ||
bool | post, | ||
const char * | fcc, | ||
char ** | finalpath, | ||
struct ConfigSubset * | sub | ||
) |
Write email to FCC mailbox.
[in] | path | Path to mailbox |
[in] | e | |
[in] | msgid | Message id |
[in] | post | If true, postpone message, else fcc mode |
[in] | fcc | fcc setting to save (postpone only) |
[out] | finalpath | Final path of email |
[in] | sub | Config Subset |
0 | Success |
-1 | Failure |
Definition at line 1058 of file sendlib.c.
int mutt_write_multiple_fcc | ( | const char * | path, |
struct Email * | e, | ||
const char * | msgid, | ||
bool | post, | ||
char * | fcc, | ||
char ** | finalpath, | ||
struct ConfigSubset * | sub | ||
) |
Handle FCC with multiple, comma separated entries.
[in] | path | Path to mailboxes (comma separated) |
[in] | e | |
[in] | msgid | Message id |
[in] | post | If true, postpone message |
[in] | fcc | fcc setting to save (postpone only) |
[out] | finalpath | Final path of email |
[in] | sub | Config Subset |
0 | Success |
-1 | Failure |
Definition at line 1005 of file sendlib.c.