Last active
March 16, 2020 00:34
-
-
Save kawaz/4152434 to your computer and use it in GitHub Desktop.
gmailでメール送信するシェルスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
user="[email protected]" | |
pass="yourpassword" | |
to="[email protected]" | |
( sleep 1 | |
echo "EHLO `hostname`" | |
sleep 1 | |
echo "AUTH PLAIN $(echo -en "$user\0$user\0$pass" | base64)" | |
sleep 1 | |
echo "MAIL FROM: <$user>" | |
sleep 1 | |
echo "rCPT TO: <$to>" | |
sleep 1 | |
echo "DATA" | |
sleep 1 | |
( echo "Subject: THIS IS TEST" | |
echo "From: $user" | |
echo "To: $to" | |
echo "" | |
echo "hello gmail" | |
echo "hehehe" | |
echo "." | |
) | perl -pe's/(?<!\r)\n/\r\n/' | |
sleep 1 | |
echo "quit" | |
) | openssl s_client -connect smtp.gmail.com:465 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@kazuihitoshi bash にしておきました