NeoMutt  2025-12-11-435-g4ac674
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
module.c File Reference

Definition of the Send Module. More...

#include "config.h"
#include <stdbool.h>
#include <stddef.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "core/lib.h"
#include "module_data.h"
+ Include dependency graph for module.c:

Go to the source code of this file.

Functions

static bool send_init (struct NeoMutt *n)
 Initialise a Module - Implements Module::init()
 
static bool send_config_define_variables (struct NeoMutt *n, struct ConfigSet *cs)
 Define the Config Variables - Implements Module::config_define_variables()
 
static bool send_commands_register (struct NeoMutt *n, struct CommandArray *ca)
 Register NeoMutt Commands - Implements Module::commands_register()
 
static bool send_cleanup (struct NeoMutt *n)
 Clean up a Module - Implements Module::cleanup()
 

Variables

struct ConfigDef SendVars []
 Config definitions for the send library.
 
const struct Command SendCommands []
 Send Commands.
 
const struct Module ModuleSend
 Module for the Send library.
 

Detailed Description

Definition of the Send Module.

Authors
  • Richard Russon

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 module.c.

Function Documentation

◆ send_init()

static bool send_init ( struct NeoMutt * n)
static

Initialise a Module - Implements Module::init()

Definition at line 44 of file module.c.

45{
46 struct SendModuleData *md = MUTT_MEM_CALLOC(1, struct SendModuleData);
48
50
51 return true;
52}
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:52
@ MODULE_ID_SEND
ModuleSend, Send
Definition module_api.h:90
void neomutt_set_module_data(struct NeoMutt *n, enum ModuleId id, void *data)
Set the private data for a Module.
Definition neomutt.c:599
#define STAILQ_INIT(head)
Definition queue.h:410
Send private Module data.
Definition module_data.h:32
struct ListHead user_header
Custom headers to add to outgoing emails.
Definition module_data.h:33
+ Here is the call graph for this function:

◆ send_config_define_variables()

static bool send_config_define_variables ( struct NeoMutt * n,
struct ConfigSet * cs )
static

Define the Config Variables - Implements Module::config_define_variables()

Definition at line 57 of file module.c.

58{
60}
bool cs_register_variables(const struct ConfigSet *cs, struct ConfigDef vars[])
Register a set of config items.
Definition set.c:290
struct ConfigDef SendVars[]
Config definitions for the send library.
Definition config.c:161
+ Here is the call graph for this function:

◆ send_commands_register()

static bool send_commands_register ( struct NeoMutt * n,
struct CommandArray * ca )
static

Register NeoMutt Commands - Implements Module::commands_register()

Definition at line 65 of file module.c.

66{
68}
bool commands_register(struct CommandArray *ca, const struct Command *cmds)
Add commands to Commands array.
Definition command.c:51
const struct Command SendCommands[]
Send Commands.
Definition commands.c:38
+ Here is the call graph for this function:

◆ send_cleanup()

static bool send_cleanup ( struct NeoMutt * n)
static

Clean up a Module - Implements Module::cleanup()

Definition at line 73 of file module.c.

74{
76 ASSERT(md);
77
79
80 FREE(&md);
81 return true;
82}
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
Definition list.c:123
#define FREE(x)
Free memory and set the pointer to NULL.
Definition memory.h:68
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:585
#define ASSERT(COND)
Definition signal2.h:59
+ Here is the call graph for this function:

Variable Documentation

◆ SendVars

struct ConfigDef SendVars[]
extern

Config definitions for the send library.

Definition at line 161 of file config.c.

161 {
162 // clang-format off
163 { "abort_noattach", DT_QUAD, MUTT_NO, 0, NULL,
164 "Abort sending the email if attachments are missing"
165 },
166 { "abort_noattach_regex", DT_REGEX, IP "\\<(attach|attached|attachments?)\\>", 0, NULL,
167 "Regex to match text indicating attachments are expected"
168 },
169 { "abort_nosubject", DT_QUAD, MUTT_ASKYES, 0, NULL,
170 "Abort creating the email if subject is missing"
171 },
172 { "abort_unmodified", DT_QUAD, MUTT_YES, 0, NULL,
173 "Abort the sending if the message hasn't been edited"
174 },
175 { "allow_8bit", DT_BOOL, true, 0, NULL,
176 "Allow 8-bit messages, don't use quoted-printable or base64"
177 },
178 { "ask_bcc", DT_BOOL, false, 0, NULL,
179 "Ask the user for the blind-carbon-copy recipients"
180 },
181 { "ask_cc", DT_BOOL, false, 0, NULL,
182 "Ask the user for the carbon-copy recipients"
183 },
184 { "ask_followup_to", DT_BOOL, false, 0, NULL,
185 "(nntp) Ask the user for follow-up groups before editing"
186 },
187 { "ask_x_comment_to", DT_BOOL, false, 0, NULL,
188 "(nntp) Ask the user for the 'X-Comment-To' field before editing"
189 },
191 "When attaching files, use one of these character sets"
192 },
193 // L10N: $attribution_intro default format
194 { "attribution_intro", DT_EXPANDO|D_L10N_STRING, IP N_("On %d, %n wrote:"), IP IndexFormatDefNoPadding, NULL,
195 "Message to start a reply, 'On DATE, PERSON wrote:'"
196 },
197 { "attribution_locale", DT_STRING, 0, 0, NULL,
198 "Locale for dates in the attribution message"
199 },
200 { "attribution_trailer", DT_EXPANDO, 0, IP IndexFormatDefNoPadding, NULL,
201 "Suffix message to add after reply text"
202 },
203 { "bounce_delivered", DT_BOOL, true, 0, NULL,
204 "Add 'Delivered-To' to bounced messages"
205 },
206 { "confirm_empty_to", DT_BOOL, false, 0, NULL,
207 "Ask for a confirmation before sending an email with an empty To recipients list"
208 },
209 { "content_type", DT_STRING, IP "text/plain", 0, NULL,
210 "Default 'Content-Type' for newly composed messages"
211 },
212 { "crypt_auto_encrypt", DT_BOOL, false, 0, NULL,
213 "Automatically PGP encrypt all outgoing mail"
214 },
215 { "crypt_auto_pgp", DT_BOOL, true, 0, NULL,
216 "Allow automatic PGP functions"
217 },
218 { "crypt_auto_sign", DT_BOOL, false, 0, NULL,
219 "Automatically PGP sign all outgoing mail"
220 },
221 { "crypt_auto_smime", DT_BOOL, true, 0, NULL,
222 "Allow automatic SMIME functions"
223 },
224 { "crypt_reply_encrypt", DT_BOOL, true, 0, NULL,
225 "Encrypt replies to encrypted messages"
226 },
227 { "crypt_reply_sign", DT_BOOL, false, 0, NULL,
228 "Sign replies to signed messages"
229 },
230 { "crypt_reply_sign_encrypted", DT_BOOL, false, 0, NULL,
231 "Sign replies to encrypted messages"
232 },
233 { "dsn_notify", DT_STRING, 0, 0, NULL,
234 "Request notification for message delivery or delay"
235 },
236 { "dsn_return", DT_STRING, 0, 0, NULL,
237 "What to send as a notification of message delivery or delay"
238 },
239 { "empty_subject", DT_STRING, IP "Re: your mail", 0, NULL,
240 "Subject to use when replying to an email with none"
241 },
242 { "encode_from", DT_BOOL, false, 0, NULL,
243 "Encode 'From ' as 'quote-printable' at the beginning of lines"
244 },
245 { "fast_reply", DT_BOOL, false, 0, NULL,
246 "Don't prompt for the recipients and subject when replying/forwarding"
247 },
248 { "fcc_attach", DT_QUAD, MUTT_YES, 0, NULL,
249 "Save sent message with all their attachments"
250 },
251 { "fcc_before_send", DT_BOOL, false, 0, NULL,
252 "Save FCCs before sending the message"
253 },
254 { "fcc_clear", DT_BOOL, false, 0, NULL,
255 "Save sent messages unencrypted and unsigned"
256 },
257 { "followup_to", DT_BOOL, true, 0, NULL,
258 "Add the 'Mail-Followup-To' header is generated when sending mail"
259 },
260 { "forward_attachments", DT_QUAD, MUTT_ASKYES, 0, NULL,
261 "Forward attachments when forwarding a message"
262 },
263 // L10N: $forward_attribution_intro default format
264 { "forward_attribution_intro", DT_EXPANDO|D_L10N_STRING, IP N_("----- Forwarded message from %f -----"), IP IndexFormatDefNoPadding, NULL,
265 "Prefix message for forwarded messages"
266 },
267 // L10N: $forward_attribution_trailer default format
268 { "forward_attribution_trailer", DT_EXPANDO|D_L10N_STRING, IP N_("----- End forwarded message -----"), IP IndexFormatDefNoPadding, NULL,
269 "Suffix message for forwarded messages"
270 },
271 { "forward_decrypt", DT_BOOL, true, 0, NULL,
272 "Decrypt the message when forwarding it"
273 },
274 { "forward_edit", DT_QUAD, MUTT_YES, 0, NULL,
275 "Automatically start the editor when forwarding a message"
276 },
277 { "forward_format", DT_EXPANDO|D_NOT_EMPTY, IP "[%a: %s]", IP IndexFormatDefNoPadding, NULL,
278 "printf-like format string to control the subject when forwarding a message"
279 },
280 { "forward_references", DT_BOOL, false, 0, NULL,
281 "Set the 'In-Reply-To' and 'References' headers when forwarding a message"
282 },
283 { "greeting", DT_EXPANDO, 0, IP &GreetingFormatDef, NULL,
284 "Greeting string added to the top of all messages"
285 },
286 { "hdrs", DT_BOOL, true, 0, NULL,
287 "Add custom headers to outgoing mail"
288 },
289 { "hidden_host", DT_BOOL, false, 0, NULL,
290 "Don't use the hostname, just the domain, when generating the message id"
291 },
292 { "honor_followup_to", DT_QUAD, MUTT_YES, 0, NULL,
293 "Honour the 'Mail-Followup-To' header when group replying"
294 },
295 { "ignore_list_reply_to", DT_BOOL, false, 0, NULL,
296 "Ignore the 'Reply-To' header when using `<reply>` on a mailing list"
297 },
298 { "include", DT_QUAD, MUTT_ASKYES, 0, NULL,
299 "Include a copy of the email that's being replied to"
300 },
301 { "inews_command", DT_EXPANDO|D_STRING_COMMAND, 0, IP &NntpFormatDef, NULL,
302 "(nntp) External command to post news articles"
303 },
304 { "me_too", DT_BOOL, false, 0, NULL,
305 "Remove the user's address from the list of recipients"
306 },
307 { "message_id_format", DT_EXPANDO, IP "<%z@%f>", IP &MsgIdFormatDef, NULL,
308 "Custom format for the Message-Id"
309 },
310 { "mime_forward_decode", DT_BOOL, false, 0, NULL,
311 "Decode the forwarded message before attaching it"
312 },
313 { "mime_type_query_command", DT_STRING|D_STRING_COMMAND, 0, 0, NULL,
314 "External command to determine the MIME type of an attachment"
315 },
316 { "mime_type_query_first", DT_BOOL, false, 0, NULL,
317 "Run the `$mime_type_query_command` before the mime.types lookup"
318 },
319 { "nm_record", DT_BOOL, false, 0, NULL,
320 "(notmuch) If the 'record' mailbox (sent mail) should be indexed"
321 },
322 { "pgp_reply_inline", DT_BOOL, false, 0, NULL,
323 "Reply using old-style inline PGP messages (not recommended)"
324 },
325 { "postpone_encrypt", DT_BOOL, false, 0, NULL,
326 "Self-encrypt postponed messages"
327 },
328 { "postpone_encrypt_as", DT_STRING, 0, 0, NULL,
329 "Fallback encryption key for postponed messages"
330 },
331 { "recall", DT_QUAD, MUTT_ASKYES, 0, NULL,
332 "Recall postponed mesaages when asked to compose a message"
333 },
334 { "reply_self", DT_BOOL, false, 0, NULL,
335 "Really reply to yourself, when replying to your own email"
336 },
337 { "reply_to", DT_QUAD, MUTT_ASKYES, 0, NULL,
338 "Address to use as a 'Reply-To' header"
339 },
340 { "reply_with_xorig", DT_BOOL, false, 0, NULL,
341 "Create 'From' header from 'X-Original-To' header"
342 },
343 { "resume_draft_files", DT_BOOL, false, 0, NULL,
344 "Process draft files like postponed messages"
345 },
346 { "reverse_name", DT_BOOL, false, 0, NULL,
347 "Set the 'From' from the address the email was sent to"
348 },
349 { "reverse_real_name", DT_BOOL, true, 0, NULL,
350 "Set the 'From' from the full 'To' address the email was sent to"
351 },
352 { "sendmail", DT_STRING|D_STRING_COMMAND, IP SENDMAIL " -oem -oi", 0, simple_command_validator,
353 "External command to send email"
354 },
355 { "sendmail_wait", DT_NUMBER, 0, 0, NULL,
356 "Time to wait for sendmail to finish"
357 },
358 { "sig_dashes", DT_BOOL, true, 0, NULL,
359 "Insert '-- ' before the signature"
360 },
361 { "sig_on_top", DT_BOOL, false, 0, NULL,
362 "Insert the signature before the quoted text"
363 },
364 { "signature", DT_PATH|D_PATH_FILE, IP "~/.signature", 0, NULL,
365 "File containing a signature to append to all mail"
366 },
367 { "smtp_authenticators", DT_SLIST|D_SLIST_SEP_COLON, 0, 0, smtp_auth_validator,
368 "(smtp) List of allowed authentication methods (colon-separated)"
369 },
370 { "smtp_oauth_refresh_command", DT_STRING|D_STRING_COMMAND|D_SENSITIVE, 0, 0, NULL,
371 "(smtp) External command to generate OAUTH refresh token"
372 },
373 { "smtp_pass", DT_STRING|D_SENSITIVE, 0, 0, NULL,
374 "(smtp) Password for the SMTP server"
375 },
376 { "smtp_url", DT_STRING|D_SENSITIVE, 0, 0, NULL,
377 "(smtp) Url of the SMTP server"
378 },
379 { "smtp_user", DT_STRING|D_SENSITIVE, 0, 0, NULL,
380 "(smtp) Username for the SMTP server"
381 },
382 { "use_8bit_mime", DT_BOOL, false, 0, NULL,
383 "Use 8-bit messages and ESMTP to send messages"
384 },
385 { "use_envelope_from", DT_BOOL, false, 0, NULL,
386 "Set the envelope sender of the message"
387 },
388 { "use_from", DT_BOOL, true, 0, NULL,
389 "Set the 'From' header for outgoing mail"
390 },
391 { "user_agent", DT_BOOL, false, 0, NULL,
392 "Add a 'User-Agent' header to outgoing mail"
393 },
395 "Width to wrap headers in outgoing messages"
396 },
397 { "write_bcc", DT_BOOL, false, 0, NULL,
398 "Write out the 'Bcc' field when preparing to send a mail"
399 },
400
401 { "abort_noattach_regexp", DT_SYNONYM, IP "abort_noattach_regex", IP "2021-03-21" },
402 { "askbcc", DT_SYNONYM, IP "ask_bcc", IP "2021-03-21" },
403 { "askcc", DT_SYNONYM, IP "ask_cc", IP "2021-03-21" },
404 { "ask_follow_up", DT_SYNONYM, IP "ask_followup_to", IP "2023-01-20" },
405 { "attach_keyword", DT_SYNONYM, IP "abort_noattach_regex", IP "2021-03-21" },
406 { "attribution", DT_SYNONYM, IP "attribution_intro", IP "2023-02-20" },
407 { "crypt_autoencrypt", DT_SYNONYM, IP "crypt_auto_encrypt", IP "2021-03-21" },
408 { "crypt_autopgp", DT_SYNONYM, IP "crypt_auto_pgp", IP "2021-03-21" },
409 { "crypt_autosign", DT_SYNONYM, IP "crypt_auto_sign", IP "2021-03-21" },
410 { "crypt_autosmime", DT_SYNONYM, IP "crypt_auto_smime", IP "2021-03-21" },
411 { "crypt_replyencrypt", DT_SYNONYM, IP "crypt_reply_encrypt", IP "2021-03-21" },
412 { "crypt_replysign", DT_SYNONYM, IP "crypt_reply_sign", IP "2021-03-21" },
413 { "crypt_replysignencrypted", DT_SYNONYM, IP "crypt_reply_sign_encrypted", IP "2021-03-21" },
414 { "envelope_from", DT_SYNONYM, IP "use_envelope_from", IP "2021-03-21" },
415 { "forw_decrypt", DT_SYNONYM, IP "forward_decrypt", IP "2021-03-21" },
416 { "forw_format", DT_SYNONYM, IP "forward_format", IP "2021-03-21" },
417 { "inews", DT_SYNONYM, IP "inews_command", IP "2025-12-15" },
418 { "metoo", DT_SYNONYM, IP "me_too", IP "2021-03-21" },
419 { "pgp_autoencrypt", DT_SYNONYM, IP "crypt_auto_encrypt", IP "2021-03-21" },
420 { "pgp_autosign", DT_SYNONYM, IP "crypt_auto_sign", IP "2021-03-21" },
421 { "pgp_auto_traditional", DT_SYNONYM, IP "pgp_reply_inline", IP "2021-03-21" },
422 { "pgp_replyencrypt", DT_SYNONYM, IP "crypt_reply_encrypt", IP "2021-03-21" },
423 { "pgp_replyinline", DT_SYNONYM, IP "pgp_reply_inline", IP "2021-03-21" },
424 { "pgp_replysign", DT_SYNONYM, IP "crypt_reply_sign", IP "2021-03-21" },
425 { "pgp_replysignencrypted", DT_SYNONYM, IP "crypt_reply_sign_encrypted", IP "2021-03-21" },
426 { "post_indent_str", DT_SYNONYM, IP "attribution_trailer", IP "2021-03-21" },
427 { "post_indent_string", DT_SYNONYM, IP "attribution_trailer", IP "2023-02-20" },
428 { "reverse_realname", DT_SYNONYM, IP "reverse_real_name", IP "2021-03-21" },
429 { "use_8bitmime", DT_SYNONYM, IP "use_8bit_mime", IP "2021-03-21" },
430
431 { "mime_subject", D_INTERNAL_DEPRECATED|DT_BOOL, 0, IP "2021-03-24" },
432 { NULL },
433 // clang-format on
434};
#define IP
Definition set.h:54
static int simple_command_validator(const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
Validate the "sendmail" config variable - Implements ConfigDef::validator() -.
Definition config.c:102
static int smtp_auth_validator(const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
Validate the "smtp_authenticators" config variable - Implements ConfigDef::validator() -.
Definition config.c:77
static int wrapheaders_validator(const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
Validate the "wrap_headers" config variable - Implements ConfigDef::validator() -.
Definition config.c:59
int charset_slist_validator(const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
Validate the multiple "charset" config variables - Implements ConfigDef::validator() -.
Definition charset.c:84
#define N_(a)
Definition message.h:32
static const struct ExpandoDefinition *const IndexFormatDefNoPadding
IndexFormatDefNoPadding - Index format definitions, without padding.
const struct ExpandoDefinition NntpFormatDef[]
Expando definitions.
Definition config.c:44
@ MUTT_NO
User answered 'No', or assume 'No'.
Definition quad.h:38
@ MUTT_ASKYES
Ask the user, defaulting to 'Yes'.
Definition quad.h:41
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
Definition quad.h:39
static const struct ExpandoDefinition MsgIdFormatDef[]
Expando definitions.
Definition config.c:140
static const struct ExpandoDefinition GreetingFormatDef[]
Expando definitions.
Definition config.c:125
#define D_SLIST_SEP_COLON
Slist items are colon-separated.
Definition types.h:112
#define D_INTERNAL_DEPRECATED
Config item shouldn't be used any more.
Definition types.h:88
#define D_STRING_COMMAND
A command.
Definition types.h:99
#define D_SLIST_ALLOW_EMPTY
Slist may be empty.
Definition types.h:116
#define D_L10N_STRING
String can be localised.
Definition types.h:82
#define D_PATH_FILE
Path is a file.
Definition types.h:104
@ DT_NUMBER
a number
Definition types.h:38
@ DT_SLIST
a list of strings
Definition types.h:42
@ DT_BOOL
boolean option
Definition types.h:32
@ DT_QUAD
quad-option (no/yes/ask-no/ask-yes)
Definition types.h:40
@ DT_SYNONYM
synonym for another variable
Definition types.h:45
@ DT_STRING
a string
Definition types.h:44
@ DT_EXPANDO
an expando
Definition types.h:34
@ DT_REGEX
regular expressions
Definition types.h:41
@ DT_PATH
a path to a file/directory
Definition types.h:39
#define D_SENSITIVE
Contains sensitive value, e.g. password.
Definition types.h:81
#define D_NOT_EMPTY
Empty strings are not allowed.
Definition types.h:80
#define D_INTEGER_NOT_NEGATIVE
Negative numbers are not allowed.
Definition types.h:101

◆ SendCommands

const struct Command SendCommands[]
extern

Send Commands.

Definition at line 38 of file commands.c.

38 {
39 // clang-format off
40 { "my-header", CMD_MY_HEADER, parse_my_header,
41 N_("Add a custom header to outgoing messages"),
42 N_("my-header <string>"),
43 "configuration.html#my-header" },
44 { "unmy-header", CMD_UNMY_HEADER, parse_unmy_header,
45 N_("Remove a header previously added with `my-header`"),
46 N_("unmy-header { * | <field> ... }"),
47 "configuration.html#my-header" },
48
49 // Deprecated
50 { "my_hdr", CMD_NONE, NULL, "my-header", NULL, NULL, CF_SYNONYM },
51 { "unmy_hdr", CMD_NONE, NULL, "unmy-header", NULL, NULL, CF_SYNONYM },
52
53 { NULL, CMD_NONE, NULL, NULL, NULL, NULL, CF_NO_FLAGS },
54 // clang-format on
55};
#define CF_SYNONYM
Command is a synonym for another command.
Definition command.h:49
#define CF_NO_FLAGS
No flags are set.
Definition command.h:48
@ CMD_MY_HEADER
:my-header
Definition command.h:97
@ CMD_NONE
No Command.
Definition command.h:59
@ CMD_UNMY_HEADER
:unmy-header
Definition command.h:140
enum CommandResult parse_my_header(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'my-header' command - Implements Command::parse() -.
Definition my_header.c:52
enum CommandResult parse_unmy_header(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'unmy-header' command - Implements Command::parse() -.
Definition my_header.c:106

◆ ModuleSend

const struct Module ModuleSend
Initial value:
= {
"send",
NULL,
NULL,
NULL,
}
static bool send_config_define_variables(struct NeoMutt *n, struct ConfigSet *cs)
Define the Config Variables - Implements Module::config_define_variables()
Definition module.c:57
static bool send_commands_register(struct NeoMutt *n, struct CommandArray *ca)
Register NeoMutt Commands - Implements Module::commands_register()
Definition module.c:65
static bool send_init(struct NeoMutt *n)
Initialise a Module - Implements Module::init()
Definition module.c:44
static bool send_cleanup(struct NeoMutt *n)
Clean up a Module - Implements Module::cleanup()
Definition module.c:73

Module for the Send library.

Definition at line 87 of file module.c.

87 {
89 "send",
91 NULL, // config_define_types
94 NULL, // gui_init
95 NULL, // gui_cleanup
97};