Last active
August 19, 2024 07:34
-
-
Save hochun836/59743d46729474f1f09366276975da6b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# base | |
smtp (simple mail transfer protocol) | |
# telnet | |
telnet <host> // port: 23 | |
telnet <host> <port> | |
telnet localhost 25 // enter interactive interface | |
# interactive (with hMailServer) | |
220 xxx ESMTP // xxx is server name | |
EHLO yyy // yyy is client domain name (or ex. EHLO HelloWorld) | |
250-xxx | |
250-SIZE 20480000 | |
250-AUTH LOGIN | |
250 HELP | |
HELP | |
211 DATA HELO EHLO MAIL NOOP QUIT RCPT RSET SAML TURN VRFY | |
NOOP | |
250 OK | |
VRFY [email protected] | |
502 VRFY disallowed. | |
RCPT TO: <[email protected]> | |
503 must have sender first. | |
DATA | |
503 Must have sender and recipient first. | |
MAIL FROM: <[email protected]> // MAIL FROM: [email protected] (ok), MAIL FROM:[email protected] (ok) | |
250 OK | |
MAIL FROM: <[email protected]> | |
503 Issue a reset if you want to start over | |
RSET | |
250 OK | |
MAIL FROM: <[email protected]> // if the mail address doesn't exist in 'Domains', it is considered as a 'external e-mail address', otherwise it is a "local e-mail address" | |
250 OK | |
RCPT TO: <[email protected]> // if the mail address doesn't exist in 'Domains', it is considered as a 'external e-mail address', otherwise it is a "local e-mail address" | |
530 SMTP authentication is required. // according to MAIL FROM & RCPT TO & 'Require SMTP authentication' (Settings > Advanced > IP Ranges > (mateched high priority) > Require SMTP authentication) | |
RSET | |
MAIL FROM: <test@thishost> | |
250 OK | |
RCPT TO: <[email protected]> | |
250 OK | |
DATA | |
354 OK, send. | |
Subject: Test Mail | |
From: [email protected] // the mail address just shows on the mail | |
To: [email protected] // the mail address just shows on the mail | |
// need a empty line | |
This is a test email sent via Telnet. | |
. // DATA finish | |
250 Queued (zzz seconds) | |
QUIT // close interactive interface | |
221 goodbye | |
Connection to host lost. | |
# interactive command | |
HELO (Hello) | |
EHLO (Extended Hello) | |
NOOP (No Operation) | |
RSET (Reset) | |
VRFY (Verify) | |
# in hMailServer, 530 SMTP authentication is required | |
AUTH LOGIN | |
334 VXNlcm5hbWU6 // VXNlcm5hbWU6 is the base64 of Username: | |
dGVzdEBsb2NhbGhvc3Q= // dGVzdEBsb2NhbGhvc3Q= is the base64 of test@localhost | |
334 UGFzc3dvcmQ6 // UGFzc3dvcmQ6 is the base64 of Password: | |
MVFhejJ3c3g= // MVFhejJ3c3g= is the base64 of 1Qaz2wsx | |
235 authenticated. | |
=> ref: https://blog.csdn.net/FunchMin/article/details/106958118 | |
=> ref: https://mailtrap.io/blog/smtp-auth/ | |
# in hMailServer, log file | |
| Settings > Logging | |
check 'Enabled' | |
check 'SMTP' | |
C:\Program Files (x86)\hMailServer\Logs\ | |
# in hMailServer, IP Ranges | |
| Settings > Advanced > IP Ranges | |
- Priority | |
a higher value means higher priority | |
- Lower ip & Upper ip | |
for matching smtp client ip | |
- Require SMTP authentication | |
if the 'MAIL FROM' mail address doesn't exist in 'Domains', it is considered as a 'external e-mail address', otherwise it is a "local e-mail address" | |
if the 'RCPT TO' mail address doesn't exist in 'Domains', it is considered as a 'external e-mail address', otherwise it is a "local e-mail address" | |
'External to external e-mail address' should normally always be selected (if you do not require authentication when external users sends messages through your server, your server will be abused by spammers) | |
=> ref: https://www.hmailserver.com/documentation/latest/?page=reference_iprange | |
# in hMailServer, reset administrator password | |
C:\Program Files (x86)\hMailServer\Bin\hMailServer.INI | |
[Security] | |
AdministratorPassword=7cba6767a5489b002c08bdb068cac033 // 7cba6767a5489b002c08bdb068cac033 is the MD5 of 1Qaz2wsx | |
# in hMailServer, ide vs. server | |
hMailServer Administrator (ide) | |
hMailServer (server) | |
like | |
SQL Server Management Studio (ide) | |
SQL Server (server) | |
# outlook | |
openssl s_client -starttls smtp -connect smtp.office365.com:587 | |
(interactive) | |
EHLO a.com | |
250-TYCP286CA0083.outlook.office365.com Hello [60.248.96.211] | |
250-SIZE 157286400 | |
250-PIPELINING | |
250-DSN | |
250-ENHANCEDSTATUSCODES | |
250-AUTH LOGIN XOAUTH2 | |
250-8BITMIME | |
250-BINARYMIME | |
250-CHUNKING | |
250 SMTPUTF8 | |
AUTH LOGIN | |
334 VXNlcm5hbWU6 | |
<username-base64-string> | |
334 UGFzc3dvcmQ6 | |
<app-password-base64-string> | |
235 2.7.0 Authentication successful | |
MAIL FROM: <[email protected]> | |
250 2.1.0 Sender OK | |
RCPT TO: <[email protected]> // 240B0000:error:0A00010A:SSL routines:can_renegotiate:wrong ssl version:ssl\ssl_lib.c:2289: | |
rcpt to: <[email protected]> // ok | |
250 2.1.5 Recipient OK | |
DATA | |
354 Start mail input; end with <CRLF>.<CRLF> | |
Subject: Test Mail | |
From: [email protected] | |
To: [email protected] | |
// need a empty line | |
This is a test email sent via openssl. (outlook) | |
. // DATA finish | |
250 2.0.0 OK <AS8P251MB0086A13302184C6CA3DE6D72F18C2@AS8P251MB0086.EURP251.PROD.OUTLOOK.COM> [Hostname=AS8P251MB0086.EURP251.PROD.OUTLOOK.COM]auth | |
IMPORTANT. microsoft app password | |
https://support.microsoft.com/en-us/account-billing/how-to-get-and-use-app-passwords-5896ed9b-4263-e681-128a-a6f2979a7944 | |
# gmail | |
openssl s_client -starttls smtp -connect smtp.gmail.com:587 | |
(interactive) | |
EHLO a.com | |
250-smtp.gmail.com at your service, [60.248.96.211] | |
250-SIZE 35882577 | |
250-8BITMIME | |
250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH | |
250-ENHANCEDSTATUSCODES | |
250-PIPELINING | |
250-CHUNKING | |
250 SMTPUTF8 | |
AUTH LOGIN | |
334 VXNlcm5hbWU6 | |
<username-base64-string> | |
334 UGFzc3dvcmQ6 | |
<app-password-base64-string> | |
235 2.7.0 Accepted | |
MAIL FROM: <[email protected]> | |
250 2.1.0 OK 98e67ed59e1d1-2d41ee18656sm3331866a91.13 - gsmtp | |
RCPT TO: <[email protected]> // 4C4A0000:error:0A00010A:SSL routines:can_renegotiate:wrong ssl version:ssl\ssl_lib.c:2289: | |
rcpt to: <[email protected]> // ok | |
250 2.1.5 OK 98e67ed59e1d1-2d41ee18656sm3331866a91.13 - gsmtp | |
DATA | |
354 Go ahead 98e67ed59e1d1-2d41ee18656sm3331866a91.13 - gsmtp | |
Subject: Test Mail | |
From: [email protected] | |
To: [email protected] | |
// need a empty line | |
This is a test email sent via openssl. (gmail) | |
. // DATA finish | |
250 2.0.0 OK 1724052123 98e67ed59e1d1-2d41ee18656sm3331866a91.13 - gsmtp | |
IMPORTANT. google app password | |
https://stackoverflow.com/a/60718806/6751999 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment