diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-01-23 18:29:14 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-01-23 18:29:14 -0700 |
commit | b8694107731a779b2e2ebd307577c8f1f6dc7c91 (patch) | |
tree | f56ff7067f6dc55164ed56745fff6a5ceb82a18e | |
parent | c3b79c295706791b809024f5247fc366a7c78c53 (diff) | |
download | mailscripts-b8694107731a779b2e2ebd307577c8f1f6dc7c91.tar.gz |
gmi2email: add --no-send
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rwxr-xr-x | gmi2email | 9 | ||||
-rw-r--r-- | gmi2email.1.pod | 6 |
2 files changed, 11 insertions, 4 deletions
@@ -33,12 +33,13 @@ use Email::Date::Format "email_date"; use Time::Local; use Mail::Field::AddrList; -my ($from, $to, $do_subs, $inline_images); +my ($from, $to, $do_subs, $inline_images, $no_mail); GetOptions "from=s" => \$from, "to=s" => \$to, "subscriptions!" => \$do_subs, - "inline-images!" => \$inline_images; + "inline-images!" => \$inline_images, + "no-send!" => \$no_mail; my $conf_r = $ENV{XDG_CONFIG_HOME} || catfile $ENV{HOME}, ".config"; my $conf_f = catfile $conf_r, "mailscripts", "gmi2email.config"; @@ -74,7 +75,7 @@ for (@ARGV) { ($type, $data) = gemini_fetch($_, abs_links => 1); $type =~ m{^text/gemini} or die "$_ is not gemtext"; } - gemtext_to_mail($data, %to_mail_opts)->send; + $no_mail or gemtext_to_mail($data, %to_mail_opts)->send; } exit unless $do_subs; @@ -133,7 +134,7 @@ foreach my $sub (<$subs_fh>) { }; #>>> $dbh->do("INSERT INTO seen VALUES (\"$uri\")"); - $mail or next; + $mail and !$no_mail or next; if ($type =~ m{^text/gemini}) { gemtext_to_mail( $data, %to_mail_opts, diff --git a/gmi2email.1.pod b/gmi2email.1.pod index 5fa6d20..d4e656c 100644 --- a/gmi2email.1.pod +++ b/gmi2email.1.pod @@ -36,6 +36,12 @@ B<~/.config/mailscripts/gmi2email.subscriptions>. Download and inline any images included in the post. +=item B<--no-send> + +Don't actually send any mail. Intended when you just added some new +subscriptions and want to avoid receiving all the old posts you've already +read. + =item B<--from=>I<ADDRESS> Set the From: address, overriding the configuration file. |