Connecting to smtp.gmail.com via command line

后端 未结 10 2368
粉色の甜心
粉色の甜心 2020-12-07 16:42

I am in the process of writing an application that sends mail via an valid GMail user ID and password.

I just wanted to simulate the SMTP connection on my Windows XP

10条回答
  •  时光取名叫无心
    2020-12-07 17:05

    This is command for connect

    • server_name: smtp.gmail.com
    • server_port: 587
    • user_name__hash: echo -n '{{user_name}}' | base64
    • user_password__hash: echo -n '{{user_password}}' | base64
    openssl s_client -connect {{server_name}}:{{server_port}} -crlf -quiet -starttls smtp
    

    and steps to accept message to send

    auth login
    {{user_name__hash}}
    {{user_password__hash}}
    helo {{server_name}}
    mail from: <{{message_from}}>
    rcpt to: <{{message_to}}>
    DATA
    from: <{{message_from}}>
    to: <{{message_to}}>
    subject:{{message_subject}}
    Content-Type: text/html; charset='UTF-8'; Content-Transfer-Encoding: base64;
    MIME-Version: 1.0
    {{message_content}}
    .
    quit
    

提交回复
热议问题