scripting Bash to access ISP mail


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting scripting Bash to access ISP mail
# 1  
Old 07-15-2009
scripting Bash to access ISP mail

I'm trying to create a small program to look at my isp and pull down the messages into individual text files. This is just a read only setup. I need to pull down the message and kill it on the server.

I'm stuck here. I have experimented with a for string but it always fails. I was trying to use date-time and the text file name and end with a .txt. I could read and delete them.

Any suggestions

#!/bin/bash
#
username="mlxxx@vabb.upn";
password="xyzpdq";
sleep 2
echo USER $username
sleep 1
echo PASS $password
sleep 2
echo STAT
sleep 1
echo QUIT
#
# cmdline string to count messages
#./getmail.sh | telnet mail.vabb.upn 110 | tail -n1 | cut -c5

---------- Post updated at 05:25 PM ---------- Previous update was at 03:49 PM ----------

here is the older version of the same code. This has the for statement that doesn't work

sleep 2
echo USER $username
sleep 1
echo PASS $password
sleep 2
echo STAT
sleep 1
#echo RETR 1
#
for i in $(seq 1 10); do echo "RETR $i">mail.txt | sleep 2 | mv mail.txt /home/otg1017/Mail/`date '+%Y%m%d-%T'`.txt ; done
sleep 2
echo QUIT


This is the command line used
# $ ./getmail.sh | telnet mail.vabb.com 110
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

What do I do in shell scripting to access ma databases from my system?

How do I go about programming my system? I have access to multiple data bases but no way to operate them (1 Reply)
Discussion started by: C-lo
1 Replies

2. UNIX for Dummies Questions & Answers

Simplest way to access Linux system mail from email client

I'm not a Linux newbie but this seemed like a pretty n00b question. I am familiar with Postfix/Dovecot setups but now I am looking for the simplest way to access mail on a Linux system, such as the mail that goes to /var/mail/root. I know I can edit /etc/aliases and have the system mail go straight... (6 Replies)
Discussion started by: TayKimchi
6 Replies

3. Shell Programming and Scripting

Scripting questions, remote access

Hi, Background: There are 2 servers server1 and server2 In server1 i have my script to perform a functionality from the script in server1 i m calling a script named action in server2. The script action has to check the size of a file in a particular location in server1, if the size of the file... (1 Reply)
Discussion started by: jayii
1 Replies

4. Programming

Access E-Mail Inbox using PHP

Hi Can anyone please help me out in the below requirement, Need to access the mailbox of any Email server like gmail, yahoo etc.. and access the Inbox and check Emails. If i have to access gmail Inbox of any user, My Input parameter will be the domain name, Email ID and Password. example... (3 Replies)
Discussion started by: vidhyaS
3 Replies

5. Solaris

Unauthorized sudo access mail

We want to get a notification for all unauthorized sudo access via e-mail to our team DL .. whats the way to do it ? (1 Reply)
Discussion started by: fugitive
1 Replies

6. Emergency UNIX and Linux Support

Access denied when sending mail - postfix

i have configured mail server with postfix with dovecot with no encryption: When connecting with Thunderbird imap is working fine. when sending email from another domain to this domain again it is fine. but when i want to send mail frommy domain to another it gives me error and this is... (3 Replies)
Discussion started by: majid.merkava
3 Replies

7. Shell Programming and Scripting

(solved) Shell scripting to access SQLPLUS using variable

I have shell script which will try to login to SQL Plus and retrieve some data, based on the outcome i will proceed further Below is the content of the file pebblz02% cat test1.ksh #! /bin/ksh dummyvar=`sqlplus -S csm_admin/csm_admin@SIDNAME <<EOF echo hi; exit; EOF` Error message on... (0 Replies)
Discussion started by: kiranlalka
0 Replies

8. UNIX for Advanced & Expert Users

Webmail access using shell scripting

Hi all, Is it possible that I can access a webmail inbox using unix shell scripting? If that is possible, can you please give me some tips so that i can proceed further? Thanks, Geetha (6 Replies)
Discussion started by: iamgeethuj
6 Replies

9. Shell Programming and Scripting

Mail Scripting

see the thread Edit the line with the ###EDIT on it to begin: print -p d rather then print -p p (0 Replies)
Discussion started by: serm
0 Replies
Login or Register to Ask a Question
pop3(n) 						      Tcl POP3 Client Library							   pop3(n)

NAME
pop3 - Tcl client for POP3 email protocol SYNOPSIS
package require Tcl 8.2 package require pop3 ?1.5.1? ::pop3::open ?-msex 0|1? ?-retr-mode retr|list|slow? host username password ?port? ::pop3::status chan ::pop3::last chan ::pop3::retrieve chan startIndex ?endIndex? ::pop3::delete chan startIndex ?endIndex? ::pop3::list chan ?msg? ::pop3::top chan msg n ::pop3::uidl chan ?msg? ::pop3::close chan DESCRIPTION
The pop3 package provides a simple Tcl-only client library for the POP3 email protocol (RFC1939). It works by opening the standard POP3 socket on the server, transmitting the username and password, then providing a Tcl API to access the POP3 protocol commands. All server errors are returned as Tcl errors (thrown) which must be caught with the Tcl catch command. COMMANDS
::pop3::open ?-msex 0|1? ?-retr-mode retr|list|slow? host username password ?port? Open a socket connection to the server specified by host, transmit the username and password as login information to the server. The default port number is 110, which can be overridden using the optional port argument. The return value is a channel used by all of the other ::pop3 functions. The command recognizes the options -msex and -retr-mode. The first of them can be used to notify the package of the fact that the server to talk to is an MS Exchange server (which has some oddities we have to work around). The default is 0. The retrieval mode determines how exactly messages are read from the server. The allowed values are retr, list and slow. The default is retr. See ::pop3::retrieve for more information. ::pop3::status chan Query the server for the status of the mail spool. The status is returned as a list containing two elements, the first is the num- ber of email messages on the server and the second is the size (in octets, 8 byte blocks) of the entire mail spool. ::pop3::last chan Query the server for the last email message read from the spool. This value includes all messages read from all clients connecting to the login account. This command may not be supported by the email server, in which case the server may return 0 or an error. ::pop3::retrieve chan startIndex ?endIndex? Retrieve a range of messages from the server. If the endIndex is not specified, only one message will be retrieved. The return value is a list containing each message as a separate element. See the startIndex and endIndex descriptions below. The retrieval mode determines how exactly messages are read from the server. The mode retr assumes that the RETR command delivers the size of the message as part of the command status and uses this to read the message efficiently. In mode list RETR does not deliver the size, but the LIST command does and we use this to retrieve the message size before the actual retrieval, which can then be done efficiently. In the last mode, slow, the system is unable to obtain the size of the message to retrieve in any manner and falls back to reading the message from the server line by line. It should also be noted that the system checks upon the configured mode and falls back to the slower modes if the above assumptions are not true. ::pop3::delete chan startIndex ?endIndex? Delete a range of messages from the server. If the endIndex is not specified, only one message will be deleted. Note, the indices are not reordered on the server, so if you delete message 1, then the first message in the queue is message 2 (message index 1 is no longer valid). See the startIndex and endIndex descriptions below. startIndex The startIndex may be an index of a specific message starting with the index 1, or it have any of the following values: start This is a logical value for the first message in the spool, equivalent to the value 1. next The message immediately following the last message read, see ::pop3::last. end The most recent message in the spool (the end of the spool). This is useful to retrieve only the most recent message. endIndex The endIndex is an optional parameter and defaults to the value "-1", which indicates to only retrieve the one message speci- fied by startIndex. If specified, it may be an index of a specific message starting with the index "1", or it may have any of the following values: last The message is the last message read by a POP3 client, see ::pop3::last. end The most recent message in the spool (the end of the spool). ::pop3::list chan ?msg? Returns the scan listing of the mailbox. If parameter msg is given, then the listing only for that message is returned. ::pop3::top chan msg n Optional POP3 command, not all servers may support this. ::pop3::top retrieves headers of a message, specified by parameter msg, and number of n lines from the message body. ::pop3::uidl chan ?msg? Optional POP3 command, not all servers may support this. ::pop3::uidl returns the uid listing of the mailbox. If the parameter msg is specified, then the listing only for that message is returned. ::pop3::close chan Gracefully close the connect after sending a POP3 QUIT command down the socket. KEYWORDS
mail, email, pop, pop3, RFC1939 pop3 1.5.1 pop3(n)