the smtp server support 250-PIPELINING function,so I can send many smtp command to server in one time
but I don't know how to test it?
I cann't find the 250-PIPELINING option on MUA (like outlook)
so I want to test it by telnet
I send two "rcpt to" command in one line,but server told me wrong:
so how can I test the 250-PIPELINING function?Thanks
You can't send 2 commands on the same line. The command syntax is the same for PIPELINED commands - the difference is that you can send multiple commands without having to wait for a response first.
The only way to test this via telnet is to first construct a text file with multiple commands and then copy & paste that into your telnet app.
Related
Recently I've been experimenting with a simple script that listens on port 25, and receives and logs any incoming emails.
It's a very primitive script, and it doesn't implement the SMTP protocol at all. It just simply spits out canned replies, and it works something like this:
Wait for an incoming socket.
Send "220 example.com ESMTP Postfix".
Receive one line, typically like "EHLO other.com".
Send "250 example.com, I am pleased to meet you".
Receive lines until "DATA", reply with "250 Ok" every time".
Send "354 End data with .".
Receive lines until "." is received.
Send 250 Ok: queued as 12345.
Receive any final lines then close the socket.
(example.com is in place of my real domain's FQDN.)
It's a very crude script indeed; however, for the past few months it's worked perfectly for every email that I needed to receive. I can receive fine from Gmail, Protonmail, verification emails, etc. I also caught some internet-wide scans, so it serves as a fun honeypot too.
Today, I tried to receive a Microsoft account verification email to register a Microsoft account. The remote client didn't seem to respond to the 220 at all!
# nc -l -v -p 25
Listening on [0.0.0.0] (family 0, port 25)
Connection from mail-co1nam03on0003.outbound.protection.outlook.com 56725 received!
220 example.com ESMTP Postfix
No matter what I tried, the client wouldn't send anything. What am I doing wrong? Any ideas are welcome.
tripleee solved this in the comments, so I'm posting it as an answer here for everyone to see. The problem is that I was giving just LF as a newline, not CRLF. So I replaced all the '\n' with '\r\n' in my code, and that fixed it. I guess the other mailservers were just being lenient with me.
I have a problem for a couple of days ago me going crazy, I have a script that sends mails using phpMailer and arsys.
The fact is that the overnight stops working, check the code and seems fine, it's more, it works correctly if I run it from the test server that comes through another IP.
I found that the server was not on any spam blackList and found the reference to be to a PBL, me worry about removing it from there.
Anyway, I still can not send mail from that server and both my other test script I programmed work correctly on development server but not on the production server.
The error that is specifically this
SMTP -> ERROR: EHLO not accepted from server:
SMTP -> ERROR: HELO not accepted from server: 220 ESMTP Postfix smtp-04.servidoresdns.net
SMTP -> ERROR: AUTH not accepted from server: 250-250-llsg993-a04.servidoresdns.net PIPELINING 250-SIZE 51200000 250-ETRN 250-250-STARTTLS AUTH DIGEST-MD5 CRAM-MD5 LOGIN PLAIN 250-AUTH = DIGEST MD5 CRAM-MD5 LOGIN PLAIN 250-250 8BITMIME ENHANCEDSTATUSCODES
It says it can not authenticate the credentials are fine but since the same script from another server goes perfectly.
Also came through a tcptraceroute to port 25 SMTP server.
Only strange thing I see is that when running
tcptraceroute p 25 smtp.miservidor.com
He says:
Sorry, Local Requested port is already in use. Use P, instead of p, to override.
But after using P instead of p and functions
Anyone shed me some light on this?
Who may be filtering my IP address ??
It's very common for ISPs to block outbound connections to port 25 by default. Try using SMTPSecure = 'tls' and Port = 587 - that server definitely responds on that port.
Connection problems are covered in the PHPMailer docs.
I noticed that never answered this question, the problem was the time, the function did not have enough time to contact with server. I increased the time in phpMailer class and everything went back to work.
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.
For our web projects, we need a reliable e-mail distribution mechanism. Due to bad experiences in the past, I have written a bash script (executed hourly) which sends a notification e-mail if
the qmail-send process is not running
there are too many failures in the mail log
For sending the notification e-mail I obviously don't want to depend on qmail, since qmail will be unavailable if the qmail-send process is not running. However, the following command sends the notification e-mail via qmail:
echo "failure rate critical" | mail -s "qmail notification" my#email.com
What's the easiest way to send e-mail from the linux command line without qmail? Can I use sendmail?
If you guys have smarter alarm systems to monitor qmail, please let me know.
Invoke the /usr/sbin/sendmail binary. It is usually available no matter which MTA you use and you can be sure it supports the standard sendmail interface if it's named sendmail.
The easiest way to use it is invoking sendmail -t and then writing the email including a valid To header to its stdin. If you omit -t you'll have to pass the recipient address as a commandline argument.
Another solution would be using SMTP but if you need to send emails from a bash script this is clearly a bad solution as there are no standard libraries in Bash which contain functions to send an email over smtp (unlike in python where you cannot easily send mails using sendmail but over SMTP).
You have a mail utility in POSIX. If you're only for linux, sendmail is ok (but then you rely on the system's (mis)configuration, right?).
All in all, SMTP protocol is not that difficult. I'd say you can talk in pure SMTP. It's about four commands to issue for a trivial mail. And it's portable:)
But if there are complications it may result in PITA...
I'd like to test to see if I can send email unauthenticated from an smtp server from my red hat box.
If I want to send a test email from command-line, I would do something like this:
mail -s Test addr#domain.com < /dev/null
How do I specify an SMTP server to send the mail through?
AFAIK you can't tell the built in 'mail' application which SMTP server to use - it simply uses sendmail on the local system.
You might want to grab the 'nail' rpm and use that instead, as then you can put 'set smtp=serveraddress' into /etc/mail.rc
You could try putting that in now, but it doesn't work on my CentOS 5.3 system.