Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I need to make a bash scripting, based on a password and a user, that connect to pop3 server and see if it login,if you can,return ok, otherwise return ERR .
if someone can help me i will appreciate it... thx.
Generally we don't write scripts outright for people, but we'll be happy to help you with your script. I would suggest that perl (or language of your choice) or expect are better suited to this task than bash overall.
Also keep in mind pop3/imap are insecure protocols... you really should be using imaps or pop3s instead.
I know they are insecure, but i need only for checking pop3 connection (telnet localhost 110 , then echo username - echo pass), if will give me -ERR or +OK, and send me email if pop3 give -ERR or +OK... theat's all.
I am new in the world of linux, and i like it verry much to work on it :P. 3Mouth
The scrept i want to be in bash, it is simply.
how far i worked at it ...
(sleep 3;
echo user email account ex: linux@questions.org;
sleep 3;
echo pass email password;
sleep 3;
echo "quit") | telnet hostname 110
how far i worked at it ...
(sleep 3;
echo user email account ex: linux@questions.org;
sleep 3;
echo pass email password;
sleep 3;
echo "quit") | telnet hostname 110
It working but now i have to find a way how to send mail.
When he give -ERR (he can't connect) send me email, when can connect to give me email with +OK.
It working but now i have to find a way how to send mail.
When he give -ERR (he can't connect) send me email, when can connect to give me email with +OK.
If you can send mail from the command line then you can use something similar in the script.
Have a look at the command line mail clients "mail" and "mailx".
Presuming you want to send mail via a remote mail server you will also need a local mail server to send the locally-created mail to the remote server. This will probably be an SMTP mail server like sendmail or postfix -- or hopefully someone will suggest a simple one!
Last edited by catkin; 04-02-2010 at 10:14 AM.
Reason: Missing "
Does that do what you wanted -- "When he give -ERR (he can't connect) send me email,"? It looks like it sends some strings to port 110 on hostname; it doesn't look like it does anything if the telnet session doesn't connect.
yes, but i put in cronjob to give me at 10 hours email. I know it not a right way... he give all the information.
now i work on samba, i will focus later on it :P.
i will try with mailx, to send me email if he can "read -u 3;".
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.