Testing SMTP using telnet is tedious as you have to remember the commands and responses in the SMTP protocol. It gets even harder when doing SMTP AUTH , as then you have to base encode a bunch of strings [ WayBack ] How to Test SMTP AUTH using Telnet [Wiki] | NDCHost Luckily there is a Perl script swaks :[ WayBack ] Swaks Swiss Army Knife for SMTP which does ESMTP and LMTP as well as TLS . The funny thing is that the repository at jetmore/swaks: Swaks Swiss Army Knife for SMTP only has the readme, but the not the script which you can get from [ WayBack ] swaks.pl .

Despite that, most linux distributions have an installation package.

[ WayBack ] swaks for OpenSuse is in the [ WayBack ] network repository, so forTumbleweed (actually: Factory) on Raspberry Pi you need to perform this: zypper addrepo http://download.opensuse.org/repositories/network/openSUSE_Factory_ARM/network.repo
zypper refresh
zypper install swaks On Mac OS X it is even easier: if you have the homebrew package manager installed, you just install the [ WayBack ] swaks formula using the [ WayBack ] swaks.rb script :

brew install swaks

Note there is also the smtp-cli Perl script which I mentioned before at Fake/Mock SMTP servers and services for use during development , which also does TLS, but few environments have ready built packages for them. If you still want to try it out:

[ WayBack ] smtp-cli ― command line SMTP client [ WayBack ] mludvig/smtp-cli: The ultimate command line SMTP client [ WayBack ] smtp-cli.pl

For SMTP AUTH:

swaks -tls --to jeroen.wiert.me@pluimers.com --from jeroen.wiert.me@pluimers.com --server smtp.xs4all.nl --auth-user username

Which prompts for the password, then outputs like this:

=== Trying smtp.xs4all.nl:25... === Connected to smtp.xs4all.nl. <- 220 smtp-cloud3.xs4all.net ESMTP ESMTP server ready -> EHLO rmbpro1tbjwp <- 250-smtp-cloud3.xs4all.net hello [188.206.68.219], pleased to meet you <- 250-HELP <- 250-AUTH LOGIN PLAIN <- 250-SIZE 157286400 <- 250-8BITMIME <- 250-STARTTLS <- 250 OK -> STARTTLS <- 220 Ready to start TLS === TLS started with cipher TLSv1:DHE-RSA-AES256-SHA:256 === TLS no local certificate set === TLS peer DN="/OU=Domain Control Validated/OU=PositiveSSL Wildcard/CN=*.xs4all.nl" ~> EHLO rmbpro1tbjwp <~ 250-smtp-cloud3.xs4all.net hello [188.206.68.219], pleased to meet you <~ 250-HELP <~ 250-AUTH LOGIN PLAIN <~ 250-SIZE 157286400 <~ 250-8BITMIME <~ 250 OK ~> AUTH LOGIN <~ 334 ############ ~> anA= <~ 334 ############ ~> ############################ <~ 235 ... authentication succeeded ~> MAIL FROM:<jeroen.wiert.me@pluimers.com> <~ 250 <jeroen.wiert.me@pluimers.com> sender ok ~> RCPT TO:<jeroen.wiert.me@pluimers.com> <~ 250 <jeroen.wiert.me@pluimers.com> recipient ok ~> DATA <~ 354 enter mail, end with "." on a line by itself ~> Date: Wed, 19 Jul 2017 09:09:57 +0200 ~> To: jeroen.wiert.me@pluimers.com ~> From: jeroen.wiert.me@pluimers.com ~> Subject: test Wed, 19 Jul 2017 09:09:57 +0200 ~> Message-Id: <20170719090957.052207@rmbpro1tbjwp> ~> X-Mailer: swaks v20170101.0 jetmore.org/john/code/swaks/ ~> ~> This is a test mailing ~> ~> . <~ 250 smtp-cloud3.xs4all.net accepted mail mXA71v00C4jr6ac01XA9Bo for delivery ~> QUIT <~ 221 smtp-cloud3.xs4all.net ESMTP closing connection === Connection closed with remote host.

jeroen

本文系统(linux)相关术语:linux系统 鸟哥的linux私房菜 linux命令大全 linux操作系统

代码区博客精选文章
分页:12
转载请注明
本文标题:Testing SMTP from the console on Linux, BSD and Mac OS: swaks and smtp-cli Perl ...
本站链接:https://www.codesec.net/view/628367.html


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 系统(linux) | 评论(0) | 阅读(59)