Skip to content

Instantly share code, notes, and snippets.

@kawaz
Last active March 16, 2020 00:34
Show Gist options
  • Save kawaz/4152434 to your computer and use it in GitHub Desktop.
Save kawaz/4152434 to your computer and use it in GitHub Desktop.
gmailでメール送信するシェルスクリプト
#!/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
@kawaz
Copy link
Author

kawaz commented Jun 19, 2019

@kazuihitoshi bash にしておきました

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment