m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/msmtp.rb
diff options
context:
space:
mode:
authorMarcin Chrzanowski <m@m-chrzan.xyz>2021-02-16 16:13:04 -0500
committerMarcin Chrzanowski <m@m-chrzan.xyz>2021-02-16 16:13:04 -0500
commitf1ebb3dba018d424cc0ab517c8c085f1ddcf20da (patch)
treec6c95e0e72f74b3ba981fb2df7c28e3ffe87bf2b /msmtp.rb
Initial commitHEADmaster
Diffstat (limited to 'msmtp.rb')
-rw-r--r--msmtp.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/msmtp.rb b/msmtp.rb
new file mode 100644
index 0000000..383be87
--- /dev/null
+++ b/msmtp.rb
@@ -0,0 +1,26 @@
+def make_msmtp_config config
+ accounts = config['accounts'].map do |account|
+ <<~END.chomp
+ # BEGIN profile generated by mmm
+ account #{account['name']}
+ host #{account['smtp']}
+ port 587
+ from #{account['email']}
+ user #{account['email']}
+ passwordeval "pass show #{account['pass_tag'] || account['name']}"
+ # END profile generated by mmm
+ END
+ end
+
+ accounts.join "\n\n"
+end
+
+def msmtprc_preamble
+ <<~END
+ defaults
+ auth on
+ tls on
+ tls_trust_file /etc/ssl/certs/ca-certificates.crt
+ logfile ~/.msmtp.log
+ END
+end