Sendmail: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
Line 14: Line 14:


==Python SMTP==
==Python SMTP==
<source lang="bash" highlight="2,3,7-8,13" line>
export ENV_EMAIL_FROM='Chorke Inc<[email protected]>';\
export ENV_EMAIL_SUBJECT='Subject for Debug Email';\
export ENV_EMAIL_TO='Academia<[email protected]>';\
export ENV_EMAIL_SENDER='[email protected]';\
export ENV_EMAIL_FROM='[email protected]';\
export ENV_EMAIL_BODY='Body for Debug Email';\
export ENV_EMAIL_TO='[email protected]';\
\
export ENV_SMTP_USER='[email protected]';\
export ENV_SMTP_USER='[email protected]';\
export ENV_SMTP_HOST='smtp.chorke.org.bd';\
export ENV_SMTP_HOST='smtp.chorke.org.bd';\
export ENV_SMTP_PASS='p@$$w0rd';\
export ENV_SMTP_PASS='p@$$w0rd';\
export ENV_SMTP_PORT='587';\
export ENV_SMTP_PORT='587';\
export ENV_SMTP_DBUG='1';\
export ENV_SMTP_TTLS='1';\
export ENV_SMTP_TTLS='1';\
(curl -s 'https://cdn.chorke.org/exec/cli/python/finology/commons/sendmail.py.txt')|python
bash <(curl -s 'https://cdn.chorke.org/exec/cli/bash/finology/commons/sendmail.sh.txt')
</source>
</source>



Revision as of 09:21, 1 August 2021

cat << EOF | sendmail -t 
Sender: [email protected]
From: Sender <[email protected]>
Reply-To: Sender <[email protected]>
To: To <[email protected]>
CC: Cc <[email protected]>
Disposition-Notification-To: [email protected]
Subject: Generic Subject

Generic Body
EOF

Python SMTP

export ENV_EMAIL_FROM='Chorke Inc<[email protected]>';\ export ENV_EMAIL_TO='Academia<[email protected]>';\ export ENV_SMTP_USER='[email protected]';\ export ENV_SMTP_HOST='smtp.chorke.org.bd';\ export ENV_SMTP_PASS='p@$$w0rd';\ export ENV_SMTP_PORT='587';\ export ENV_SMTP_TTLS='1';\ bash <(curl -s 'https://cdn.chorke.org/exec/cli/bash/finology/commons/sendmail.sh.txt') </source>

Knowledge

/usr/sbin/sendmail -Am -v -t < filename.eml
/usr/sbin/sendmail -v -t < filename.eml
/usr/sbin/sendmail -t < filename.eml
launch interpreter by magic header or env
1. Python 3.9: #!/usr/bin/env python3.9
2. Python 2.6: #!/usr/bin/env python2.6
3. TS Node   : #!/usr/bin/env ts-node
4. Python    : #!/usr/bin/env python
5. NodeJS    : #!/usr/bin/env node
6. Ruby      : #!/usr/bin/env ruby
7. Perl      : #!/usr/bin/env perl
8. PHP       : #!/usr/bin/env php
9. GO        : #!/usr/bin/env go run
#resolve mail server
nslookup
: '
Default Server:  www0.dev.chorke.org
Address:  10.20.13.100

> set type=mx
> chorke.org
Server:  www0.dev.chorke.org
Address:  10.20.13.100

Non-authoritative answer:
chorke.org      MX preference = 0, mail exchanger = mail.chorke.org
> exit
'

References