read google email from telnet - email

C:\Users\Wild Beast>openssl s_client -starttls smtp -connect smtp.gmail.com:587 CONNECTED(000001B8)
I got connected with the server and was able to login but when I use list command to read the mails. It showed the error
235 2.7.0 Accepted
list
502 5.5.1 Unrecognized command. m7-20020adfe0c7000000b002060e7bbe49sm16301005wri.45 - gsmtp

SMTP on port 587 is used for submitting emails to the outgoing mail server and has no LIST command. You may want to look into POP3 or IMAP to fetch emails from the incoming mail server of your mailbox provider. Let me know if you need help with that.

Related

Email is bouncing off from few mail providers

when im trying to send email from my domain to polish email providers onet.pl and gazeta.pl im getting bounce back message:
A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed:
XXX#gazeta.pl
SMTP error from remote mail server after HELO mydomain.com:
host mx.poczta.gazeta.pl [1.1.1.1]: 503 5.7.0 Error:
access denied for unknown[2.2.2.2]
I have configured ptr and mx record. Please help.
There are so many possibilities for the mail denied. Please check :
1) Your mail server IP address should not be blacklisted anywhere. You can check it from http://multirbl.valli.org/lookup/
2) Make sure that the recipient mail server listen on the port which you are using i.e. Port 25. Please check if the port 587 works. You can also try port 465 with TLS.
3) Check if any Antivirus application installed on your side causes the issue.

Sending gmail using port 587

I am trying to send a gmail, here are the commands, using port 587:
EHLO smtp.gmail.com
STARTTLS
AUTH LOGIN
base64_encoded_username
base64_encoded_password
MAIL FROM:<me#gmail.com>
RCPT TO:<other#gmail.com>
DATA
SUBJECT: Hello!
This is the text
QUIT
The server says "Ready to start TLS" What I am doing wrong?

Send mail via CMD console

Hi i want to send mail via microsoft cmd console. I tried many way, but i didnt succeed.
i tried this article http://jpsoft.com/help/index.htm?sendmail.htm
sendmail "bob#bob.com bcc:joe#joe.com" Test Hello!
the error is :
'sendmail' is not recognized as an internal or external command operable program or batch file
and
this article : http://www.brighthub.com/office/collaboration/articles/21840.aspx#imgn_1
c:\>"c:\program files\microsoft office\office12\outlook.exe" /c ipm.note /m someone#gmail.com /a "c:\logs\logfile.txt"
the error is :
the process can not access the file because it is being used by another proccess
but it didnt worked. i dont know where is the problem or what is the problem.
thanks for your advice.
Scenario:
Your domain: mydomain.com
Domain you wish to send to: theirdomain.com
1. Determine the mail server you're sending to.
Open a CMD prompt
Type
NSLOOKUP
set q=mx
theirdomain.com
Response:
Non-authoritative answer:
theirdomain.com MX preference = 50, mail exchanger = mail.theirdomain.com
Nslookup_big
EDIT
Be sure to type exit to terminate NSLOOKUP.
2. Connect to their mail server
SMTP communicates over port 25. We will now try to use TELNET to connect to their mail server "mail.theirdomain.com"
Open a CMD prompt
TELNET MAIL.THEIRDOMAIN.COM 25
You should see something like this as a response:
220 mx.google.com ESMTP 6si6253627yxg.6
Be aware that different servers will come up with different greetings but you should get SOMETHING. If nothing comes up at this point there are 2 possible problems. Port 25 is being blocked at your firewall, or their server is not responding. Try a different domain, if that works then it's not you.
3. Send an Email
Now, use simple SMTP commands to send a test email. This is very important, you CANNOT use the backspace key, it will work onscreen but not be interpreted correctly. You have to type these commands perfectly.
ehlo mydomain.com
mail from:<martin9700#mydomain.com>
rcpt to:<recipient#theirdomain.com>
data
This is a test, please do not respond
.
quit
So, what does that all mean?
EHLO - introduce yourself to the mail server HELO can also be used but EHLO tells the server to use the extended command set (not that we're using that).
MAIL FROM - who's sending the email. Make sure to place this is the greater than/less than brackets as many email servers will require this (Postini).
RCPT TO - who you're sending it to. Again you need to use the brackets. See Step #4 on how to test relaying mail!
DATA - tells the SMTP server that what follows is the body of your email. Make sure to hit "Enter" at the end.
. - the period alone on the line tells the SMTP server you're all done with the data portion and it's clear to send the email.
quit - exits the TELNET session.
4. Test SMTP relay
Testing SMTP relay is very easy, and simply requires a small change to the above commands. See below:
ehlo mydomain.com
mail from:<martin9700#mydomain.com>
rcpt to:<recipient#someotherdomain.com>
data
This is a test, please do not respond
.
quit
See the difference? On the RCPT TO line, we're sending to a domain that is not controlled by the SMTP server we're sending to. You will get an immediate error is SMTP relay is turned off. If you're able to continue and send an email, then relay is allowed by that server.
Unless you want to talk to an SMTP server directly via telnet you'd use commandline mailers like blat:
blat -to you#example.com -f me#example.net -s "mail subject" ^
-server smtp.example.net -body "message text"
or bmail:
bmail -s smtp.example.net -t you#example.com -f me#example.net -h ^
-a "mail subject" -b "message text"
You could also write your own mailer in VBScript or PowerShell.
From Linux you can use 'swaks' which is available as an official packages on many distros including Debian/Ubuntu and Redhat/CentOS on EPEL:
swaks -f you#example.net -t someone#example.com \
--server mail.example.com
A couple more command-line mailer programs:
mailsend
Mail Alert Simple Mailer
Both support SSL too.

Using SMTP, Gmail, and STARTTLS

So I'm learning about SMTP and am trying to use telnet to send some mail over SMTP.
I've easilly been able to send mail to my gmail account via:
$ host gmail.com
...
gmail.com mail is handled by 5 gmail-smtp-in.l.google.com.
...
$ telnet gmail-smtp-in.l.google.com 25
Trying 74.125.142.27...
...
Connected to gmail-smtp-in.l.google.com.
...
HELO <me#test.com>
...
However, I'm having trouble sending from my gmail account. From what I understand about SMTP, I should be using SMTP to send mail from < mygmailaddress#gmail.com >
to the outgoing gmail SMTP servers, which in turn use SMTP to transfer the mail to the receivers incoming SMTP server ect.
However, I'm having difficulties. If I telnet into smtp.gmail.com via port 465 (gmail outgoing smtp mail server canonical), I'm immediately disconnected after starting with HELO <blah#blah.com>, or asked to STARTTLS. I can't find answers on how to proceed.
Any help is appreciated.
Sidenote: Currently I'm using Starbucks free Wi-Fi to access the internet. I'm actually unable to telnet directly from my computer (No route to host error). Instead, it only works if I ssh into a remote linux box on my school's network first, then telnet from there. Any idea why this is?
Thanks!
First of all, it looks like you're using the wrong port. Gmail exposes port 465 for SMTP over SSL and port 587 for SMTP with STARTTLS, as documented here. The difference between these two is that SMTP over SSL first establishes a secure SSL/TLS connection and conducts SMTP over that connection, and SMTP with STARTTLS starts with unencrypted SMTP and then switches to SSL/TLS. This is why you don't get a response to your HELO.
$ telnet smtp.gmail.com 587
Trying 74.125.25.108...
Connected to gmail-smtp-msa.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP fr1sm24834956pbb.26 - gsmtp
HELO <me#test.com>
250 mx.google.com at your service
STARTTLS
220 2.0.0 Ready to start TLS
But even if you telnet to port 587 you still aren't going to be able to send any email by hand. In order to do anything interesting you will have to STARTTLS, and you won't be able to handle the SSL/TLS binary protocol to negotiate the encryption.
The telnet client will not negotiate a TLS session for you. You should use another tool, such as OpenSSL's s_client. The following issues the STARTTLS command for you and handles the TLS negotiation:
$ openssl s_client -starttls smtp -connect smtp.gmail.com:587 -crlf
Alternatively, you could connect directly to the SMTPS port:
$ openssl s_client -connect smtp.gmail.com:465 -crlf

Send email using Telnet

I found this article which explains sending email from telnet
http://www.kongtechnology.com/2008/01/27/smtp-authentication-and-send-emails-using-telnet/
but actually I have problem with it.
when i wrote this command
auth login
I got
Connection to host lost.
so, what is the problem?
http://www.ionfish.org/mxlookup
Type the URL of the site you want to find's mail server.
Open CMD, type:
telnet mx.sitedomain.com 25
then
HELO mx.sitedomain.com
next
MAIL FROM: president#whitehouse.gov
then
RCPT TO: secretary#whitehouse.gov
finally
SUBJECT: This message was brought to you in part by the moon.
Note: You need to send authentication requests, because most mail servers do not allow anonymous unsolicited mail to be sent. (spam).
http://technet.microsoft.com/en-us/library/aa995718%28v=exchg.65%29.aspx