How to Check If Smtp Is Working from Commandline (Linux)

How to check if SMTP is working from commandline (Linux)

Syntax for establishing a raw network connection using telnet is this:

telnet {domain_name} {port_number}

So telnet to your SMTP server like

telnet smtp.mydomain.example 25

And copy and paste the below

helo client.mydomain.example
mail from:<sender@mydomain.example>
rcpt to:<to_email@mydomain.example>
data
From: test@mydomain.example
Subject: test mail from command line

this is test number 1
sent from linux box
.
quit

Note : Do not forgot the "." at the end which represents the end of the message.
The "quit" line exits ends the session.

How to figure out the SMTP server host?

You could send yourself an email an look in the email header (In Outlook: Open the mail, View->Options, there is 'Internet headers)

smtp login in linux terminal

I think you're looking for a 3rd party testing application with TLS, AUTH support exactly what swaks is.

Install Swaks

$ pacman -S swaks         # ArchLinux
$ apt install swaks # Debian/Ubuntu
$ dnf install swaks # Fedora

Using Swaks

Taking a quick look at man swaks or swaks' latest documents, will give us quite the understandment about how the operation can be done:

$ swaks --to reciever@domain.com --from sender@domain.com \
--auth-user sender@domain.com --auth-password Th1s15SendersPassword \
--auth CRAM-MD5 --header-X-Test "test email"

Refer to swaks website for full information.

How do i send an email from command prompt?

Version for terminal:

mail somebody@gmail.com

Version for shell scripts:

echo "This is a short email" | mail -n -s "Sending email" somebody@gmail.com

AFAIK typical Linux distribution install MTA (sendmail/postfix/exim/...) by default. If you have static public IP address then its quite possible you have a working self-configuration.

Configuration of MTA without static public IP is more tricky.

send mail from linux terminal in one line

mail can represent quite a couple of programs on a linux system. What you want behind it is either sendmail or postfix. I recommend the latter.

You can install it via your favorite package manager. Then you have to configure it, and once you have done that, you can send email like this:

 echo "My message" | mail -s subject user@gmail.com

See the manual for more information.

As far as configuring postfix goes, there's plenty of articles on the internet on how to do it.
Unless you're on a public server with a registered domain, you generally want to forward the email to a SMTP server that you can send email from.

For gmail, for example, follow
http://rtcamp.com/tutorials/linux/ubuntu-postfix-gmail-smtp/
or any other similar tutorial.

verify email address on Linux

The following command and link have solved the issue.

-nslookup command help to find out mail server address for examplesite.com

nslookup -type=mx examplesite.com;

-https://superuser.com/questions/224015/how-to-check-if-email-address-does-exist

The answer instruction in the link help to verfiy the email address completely



Related Topics



Leave a reply



Submit