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
Related
Honestly, I think I have a fundamental gap in understanding how SMTP works. I can't seem to find a good explanation of what is happening behind the scenes and I think this is preventing me from being able to do what I am attempting to do.
To explain, I'm trying to setup an application which sends notifications to users by connecting to an SMTP server. Fair enough. I figure, since I'm using my own domain, I have SPF/DKIM/DMARC configured, I can add an MX record for the host I set the application up on (my SPF record has the mx keyword to authorize any hosts in my MX records to send/receive mails). Then, I can have that same host run a super lightweight SMTP server that can accept mails from the application, and send them on to recipients.
Almost crucially, I want this server to basically just run on localhost so that only this application can connect and send mails through it, but so that it can't really "receive" mails sent to my domain (I have set the MX priority very low (well, a high number) for this app server). I figure since I'm running my own SMTP server, that I don't really need to authenticate against it (it's running on localhost), just take in any mail and send it on to recipient domains.
When sending on to recipient domains... does the SMTP server need to authenticate to say, the gmail SMTP server as a user in order to send mails over there? That seems weird, since it's not a user logging into gmail to send mails, it's an SMTP server that is authorized within SPF sending mail from my domain (From address from my domain as well) to where ever the app server user's email is based (in this example, the user would be e.g., some_user#gmail.com).
I tried using python's aiosmtpd command-line and telnet to send a mail from test#MY_DOMAIN.TLD to test#MY_DOMAIN.TLD and it didn't seem to deliver the message; I figured aiosmtpd would connect to the preferred MX servers for my domain (my "real" MX's) to transfer the message, which would then put it in my inbox. That didn't seem to be the case, and I'm not sure why.
Exact repro steps, where example.com is my domain, and terminals are running on a box with a hostname listed in my MX records.
Terminal A:
$ aiosmtpd -n
Terminal B:
$ telnet localhost 8025
EHLO <example.com>
MAIL FROM: test#example.com
RCPT TO: test#example.com
DATA
FROM: Application Notifications <test#example.com>
TO: User Name <test#example.com>
SUBJECT: App Notify Test
This is a test!
.
QUIT
How do SMTP servers normally send mail between each other? Do they each get some login to each other's SMTP servers to authenticate with, and since I'm not doing that, this is a problem? Can I run a SMTP server on localhost and have it send mail out of the network without receiving mails (a no-reply service)? Is there something obvious that I'm just missing here that solves all my problems?
Thanks
It sounds like you want to run a mail transfer agent (MTA) that relays email to remote SMTP servers. An MTA will typically act as an SMTP server to receive messages, and then it will act as an SMTP client when it relays the messages to remote hosts.
MTAs generally operate in two different modes: (1) They will relay messages from authenticated users to remote hosts, and (2) they will receive messages from remote hosts to its users and store them somehow. The combination of those two modes - where the MTA will accept messages from remote hosts and relay them to different remote hosts - is called an open relay and is sure to attract spammers and place your server on spam blacklists.
aiosmtpd is not an MTA or an email relay out of the box - it is merely an SMTP server that will receive messages and do whatever with the messages you program it to do. By default it will do nothing - that is, it will receive the messages and throw them away. If you want to implement an email relay in aiosmtpd, then you need to implement the SMTP client portion of the MTA, e.g. by implementing an aiosmtpd handler that instantiates smtplib.SMTP to connect to remote hosts.
However, if all you want is an email relay, then you most likely don't need aiosmtpd at all - postfix is probably a better choice.
aiosmtpd can be a good choice if you need to implement mailing list software or perform some automation tasks based on incoming emails from e.g. cameras or scanners.
If you want to implement an email relay in aiosmtpd, then you need to ensure that both the software and your server are configured in a way that you don't relay unauthenticated messages from the outside internet.
See also: Python aiosmtpd - what is missing for an Mail-Transfer-Agent (MTA)?
So, I actually figured out what was missing here.
I need to run an SMTP server, yes, but I also needed to write code to parse the "to" domain (the recipient domain), perform a DNS request for the MX server(s) of the recipient domain, and then use the smtplib client to then send mail over to the recipient domain. Authentication is not needed to relay that message to the recipient server, authentication is only required for reading from a given inbox or authenticating a sender to send on behalf of a domain (I trust myself and myself only to send mail). I can do all this while also only listening for mail on localhost so that only my local server can use the local SMTP server for relaying messages/emails off to recipient domains.
Additionally, I don't need to have my external IP listed as an MX server since it's not accepting mail for the domain, only sending. I do need an SPF record for it though so that it is an authorized relay/sender for email from my domain.
I'm currently trying to setup PEPS on my server, and having a problem receiving email sent from an external address.
I'm able to send and receive email internally fine, and i'm also able to send email externally, but I never receive email sent from an external address.
I can telnet in to port 25, but I get
connection to host lost
at the end of
HELO example.co.uk
MAIL FROM: address#other.co.uk
RCPT TO: aname#example.co.uk
DATA
Subject: Test
<ENTER>
test Message
.
After i've typed the '.' I instantly get the connection to host lost message
My servers setup using nginx, with multiple sub-domains, i've got PEPS running on mail.example.co.uk via a reverse proxy, and that bit works fine.
I'm interesting to host my website portal at home, I've got public ip from my isp, got good server, installed cent os, installed cpanel, copied website but seems that email server not working good.
When testing to multiple receivers, few mails are delivered ok but few message are not delivering, example of errors:
error1:
SMTP error from remote mail server after initial connection: 554 n1plibsmtp01-02.prod.ams1.secureserver.net bizsmtp IB106. Connection refused. MYIP is listed on the Policy Block List (PBL).\302\240
error2:
ECDHE-RSA-AES256-SHA384:256 CV=yes: SMTP error from remote mail server after MAIL FROM:MYEMAIL SIZE=1669: 550 DY-001 (COL004-MC2F3) Unfortunately, messages from MYIP weren't sent. Please contact your Internet serv
error3:
ECDHE-RSA-AES256-SHA384:256 CV=yes: SMTP error from remote mail server after MAIL FROM:MYEMAIL SIZE=1669: 550 DY-001 (BLU004-MC1F26) Unfortunately, messages from 213.163.119.60 weren't sent. Please contact your Internet ser
Delivered emails have this message:
Accepted
So since few emails are delivered and few emails are not delivered, seems blocked by hotmail, gmail, yahooo, or marked as spam.. means that problem is to my ISP?
Services like Gmail, Outlook.com and Yahoo! Mail block email to protect from unwanted or malicious email such as phishing, scams and spam. In this case, they are mistaking email that you are sending.
There is something like "whitelisting domain" but I am not too sure on that. I think that can help ??
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.
Do the SMTP logs on a server (Windows 2003) only show logs of mail that were sent successfully?
We are getting bounce backs when sending mail to a particular domain:
The connection was dropped by the remote host.
It looks like a problem on the receiving server, but we dont have much information to provide them. We can send to hotmail, gmail, yahoo etc OK.
Any ideas?
Most likely, there is a spam filter in front of the receiving mail server for this domain, and this spam filter thinks your mail server is sending spam, so it's closing the connection from your mail server. One way to test this is to simulate sending a message to this mail server by opening a command prompt on your mail server, and use telnet to connect to the receiving mail server on port 25, and proceed with the process of sending a message just as a mail server would. This way, you'll be able to see how the receiving mail server responds after each step. Follow the instructions in http://support.microsoft.com/kb/153119 to see how this is done.
It turned out the sending server was blacklisted by McAfee, that was running on the receiving servers firewall.
For those that may have the problem in the future you can check if your server is blacklisted with McAfee here:
http://www.mcafee.com/threat-intelligence/ip/spam-senders.aspx
After entering your server IP, you should see a link Threat Feedback. Use this to email McAfee.
I was able to send McAfee an email with an explanation, they then removed our server from the blacklist.