Miscellaneous functions for sending an email. More...
#include "config.h"#include <inttypes.h>#include <limits.h>#include <stdbool.h>#include <stdio.h>#include <string.h>#include <sys/stat.h>#include <sys/types.h>#include <unistd.h>#include "mutt/lib.h"#include "address/lib.h"#include "config/lib.h"#include "email/lib.h"#include "core/lib.h"#include "mutt.h"#include "sendlib.h"#include "attach/lib.h"#include "convert/lib.h"#include "ncrypt/lib.h"#include "body.h"#include "copy.h"#include "globals.h"#include "handler.h"#include "header.h"#include "mutt_mailbox.h"#include "muttlib.h"#include "mx.h"#include "send.h"#include "sendmail.h"#include "smtp.h"
Include dependency graph for sendlib.c:Go to the source code of this file.
Functions | |
| enum ContentType | mutt_lookup_mime_type (struct Body *b, const char *path) |
| Find the MIME type for an attachment. | |
| static void | transform_to_7bit (struct Body *b, FILE *fp_in, struct ConfigSubset *sub) |
| Convert MIME parts to 7-bit. | |
| void | mutt_message_to_7bit (struct Body *b, FILE *fp, struct ConfigSubset *sub) |
| Convert an email's MIME parts to 7-bit. | |
| static void | set_encoding (struct Body *b, struct Content *info, struct ConfigSubset *sub) |
| Determine which Content-Transfer-Encoding to use. | |
| void | mutt_stamp_attachment (struct Body *b) |
| Timestamp an Attachment. | |
| void | mutt_update_encoding (struct Body *b, struct ConfigSubset *sub) |
| Update the encoding type. | |
| struct Body * | mutt_make_message_attach (struct Mailbox *m, struct Email *e, bool attach_msg, struct ConfigSubset *sub) |
| Create a message attachment. | |
| static void | run_mime_type_query (struct Body *b, struct ConfigSubset *sub) |
| Run an external command to determine the MIME type. | |
| struct Body * | mutt_make_file_attach (const char *path, struct ConfigSubset *sub) |
| Create a file attachment. | |
| static void | encode_headers (struct ListHead *h, struct ConfigSubset *sub) |
| RFC2047-encode a list of headers. | |
| 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. | |
| void | mutt_prepare_envelope (struct Envelope *env, bool final, struct ConfigSubset *sub) |
| Prepare an email header. | |
| void | mutt_unprepare_envelope (struct Envelope *env) |
| Undo the encodings of mutt_prepare_envelope() | |
| static int | bounce_message (FILE *fp, struct Mailbox *m, struct Email *e, struct AddressList *to, const char *resent_from, struct AddressList *env_from, struct ConfigSubset *sub) |
| Bounce an email message. | |
| int | mutt_bounce_message (FILE *fp, struct Mailbox *m, struct Email *e, struct AddressList *to, struct ConfigSubset *sub) |
| Bounce an email message. | |
| static void | set_noconv_flags (struct Body *b, bool flag) |
| Set/reset the "x-mutt-noconv" flag. | |
| 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. | |
| 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. | |
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.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 75 of file sendlib.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Convert MIME parts to 7-bit.
| b | Body of the email |
| fp_in | File to read |
| sub | Config Subset |
Definition at line 195 of file sendlib.c.
Here is the call graph for this function:
Here is the caller graph for this function:| 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 258 of file sendlib.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Determine which Content-Transfer-Encoding to use.
| [in] | b | Body of email |
| [out] | info | Info about the email |
| [in] | sub | Config Subset |
Definition at line 350 of file sendlib.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void mutt_stamp_attachment | ( | struct Body * | b | ) |
Timestamp an Attachment.
| b | Attachment |
Definition at line 409 of file sendlib.c.
Here is the call graph for this function:
Here is the caller graph for this function:| 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 421 of file sendlib.c.
Here is the call graph for this function:
Here is the caller graph for this function:| 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 453 of file sendlib.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Run an external command to determine the MIME type.
| b | Attachment |
| sub | Config Subset |
The command in $mime_type_query_command is run.
Definition at line 565 of file sendlib.c.
Here is the call graph for this function:
Here is the caller graph for this function:| 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 606 of file sendlib.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
RFC2047-encode a list of headers.
| h | String List of headers |
| sub | Config Subset |
The strings are encoded in-place.
Definition at line 666 of file sendlib.c.
Here is the call graph for this function:
Here is the caller graph for this function:| 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 706 of file sendlib.c.
Here is the call graph for this function:
Here is the caller graph for this function:| 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 752 of file sendlib.c.
Here is the call graph for this function:
Here is the caller graph for this function:| 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 779 of file sendlib.c.
Here is the call graph for this function:
Here is the caller graph for this function:| 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 818 of file sendlib.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Bounce an email message.
| fp | Handle of message |
| m | Mailbox |
| e | |
| to | Address to bounce to |
| resent_from | Address of new sender |
| env_from | Envelope of original sender |
| sub | Config Subset |
| 0 | Success |
| -1 | Failure |
Definition at line 844 of file sendlib.c.
Here is the call graph for this function:
Here is the caller graph for this function:| 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 916 of file sendlib.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Set/reset the "x-mutt-noconv" flag.
| b | Body of email |
| flag | If true, set the flag, otherwise remove it |
Definition at line 974 of file sendlib.c.
Here is the call graph for this function:
Here is the caller graph for this function:| 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 1004 of file sendlib.c.
Here is the call graph for this function:
Here is the caller graph for this function:| 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 1057 of file sendlib.c.
Here is the call graph for this function:
Here is the caller graph for this function: