{"id":4581,"date":"2025-07-10T08:57:42","date_gmt":"2025-07-10T08:57:42","guid":{"rendered":"https:\/\/geekmungus.co.uk\/?p=4581"},"modified":"2025-07-10T08:57:44","modified_gmt":"2025-07-10T08:57:44","slug":"testing-smtps-from-command-line-with-authentication","status":"publish","type":"post","link":"https:\/\/geekmungus.co.uk\/?p=4581","title":{"rendered":"Testing SMTPS from Command Line (with Authentication)"},"content":{"rendered":"\n<p>Just like the testing of SMTP using Telnet, you can also perform the same steps if the target server is using TLS, however because telnet won&#8217;t do the job here, you can use OpenSSL instead. <\/p>\n\n\n\n<p>Here&#8217;s a simple example.<\/p>\n\n\n\n<p>Firstly get your Username and Password in Base64 format.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>echo -n \"username\" | base64\necho -n \"password\" | base64<\/code><\/pre>\n\n\n\n<p>You&#8217;ll get the Base64 encoded strings outputted after each command. Now you can make the connection and authenticate.<\/p>\n\n\n\n<p>Notice the -quiet at the end of the command, this is needed to ensure that if your username or password string contain &#8220;Q&#8221; it doesn&#8217;t just quit the command, see <a href=\"https:\/\/superuser.com\/questions\/1179522\/why-do-i-get-done-after-auth-login-command-to-smtp-server\">https:\/\/superuser.com\/questions\/1179522\/why-do-i-get-done-after-auth-login-command-to-smtp-server<\/a> for more details on this.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>openssl s_client -starttls smtp -crlf -connect mail.domain.com:587 -quiet\n\nehlo senderdomain.com\n\nauth login\n\nauth login\n334 VXNlcm5hbWU6\n&lt;Base64 encoded username>\n334 UGFzc3dvcmQ6\n&lt;Base64 encoded password>\n235 2.7.0 Authentication successful\n\nmail from:info@senderdomain.com\nrcpt to:info@domain.com\ndata\nTo:info@domain.com\nFrom:info@senderdomain.com\nSubject:A Test Message for You!\nHello,\nHow are you?\nThanks\nTristan\n.<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Just like the testing of SMTP using Telnet, you can also perform the same steps if the target server is using TLS, however because telnet won&#8217;t do the job here, you can use OpenSSL instead. Here&#8217;s a simple example. Firstly get your Username and Password in Base64 format. You&#8217;ll get the Base64 encoded strings outputted &#8230; <a title=\"Testing SMTPS from Command Line (with Authentication)\" class=\"read-more\" href=\"https:\/\/geekmungus.co.uk\/?p=4581\" aria-label=\"Read more about Testing SMTPS from Command Line (with Authentication)\">Read more<\/a><\/p>\n","protected":false},"author":4,"featured_media":4439,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"class_list":["post-4581","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-random"],"_links":{"self":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/4581","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4581"}],"version-history":[{"count":1,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/4581\/revisions"}],"predecessor-version":[{"id":4582,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/4581\/revisions\/4582"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/media\/4439"}],"wp:attachment":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4581"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4581"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4581"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}