Visit Our UNIX and Linux User Community


script to read mail


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting script to read mail
# 1  
Old 08-19-2009
MySQL script to read mail

Hi,

I want to write a script that will read mail ( for eg: from abc.def@yahoomail.com ). And if it finds a particular subject then do something..

Is it possible....

Please help...
Thanks in adv..
# 2  
Old 08-19-2009
Look into procmail. It's a big subject, be prepared to read quite a bit, but it's certainly possible to do what you want with it.
# 3  
Old 08-19-2009
Its quite possible, PM me if interested in a PERL solution
# 4  
Old 08-19-2009
seen procmail. but i cannot install procmail to the sysatem....
can anyone give me some code to accomplish this..

Thanks
# 5  
Old 08-19-2009
Which Operating System?
Which shell?
Which mail program?
# 6  
Old 08-20-2009
operating system: unix HP
shell: ksh

Dont know anything bout mail program....

Thanks,

---------- Post updated at 08:06 AM ---------- Previous update was at 12:58 AM ----------

Can anyone help me out in writing shell script to read mail.

Thanks..
# 7  
Old 08-28-2009
Add an alias in /etc/mail/aliases like the following
user: user, |/usr/user/myprocess

Run "newaliases"
Send an email to user . The entire email including headers will be used as standard input to the "myprocess" script.
The my process script should look something like:

while read line
do
if [ "a`echo $line|cut -c 1-8`" = "aSubject:" ]
#we add the "a" to the beginning of the test to ensure that the argument is not null
then
test=`echo $line|cut -d":" f2`
if [ "a$test" = "aGOODEMAIL" ]
then
run_my_script
fi
fi
done

Previous Thread | Next Thread
Test Your Knowledge in Computers #640
Difficulty: Medium
After the purchase of NeXT by Apple, NeXT became the source for macOS, iOS, watchOS, and tvOS.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to Read mail in a UNIX server?

My unix server is somehow configured to send mail to any id in my network. However, how do I read the mails in my inbox. I can send mails using mailx -s However, when I try to check whether there is mail using mailx -e it shows invalid option. (2 Replies)
Discussion started by: srkmish
2 Replies

2. UNIX for Advanced & Expert Users

Read mail attachments in AIX

Hello All, Is there a way to read/view email attachments in AIX? Here's my scenario; I have users that will being scanning documents for digital storage. To make it easier for the users, I would like for them to scan and email the pdf version of the document directly to one of my AIX... (3 Replies)
Discussion started by: bbbngowc
3 Replies

3. OS X (Apple)

Read and manage mail under Terminal

When opening Terminal window under Mac OS Lion, I have a message saying I've got mail . It seems to be somewhere close to ~/Library/Server/Mail/Data/spool/ but I ignore what command to be typed in order to read it and suppress it later once read. (1 Reply)
Discussion started by: shub22
1 Replies

4. UNIX for Dummies Questions & Answers

read mail question

how do I save a email I just read to a new file? Thanks. (3 Replies)
Discussion started by: drew211
3 Replies

5. Shell Programming and Scripting

script to read mail on a mail server

Hi All, Is there any way Unix shell script can directly read a mail on a mail server (for eg. abc@xyz.com) and save it as a text file in a unix directory ? Thanks PRKS ---------- Post updated at 08:37 AM ---------- Previous update was at 08:36 AM ---------- I am using ksh (1 Reply)
Discussion started by: PRKS
1 Replies

6. UNIX for Advanced & Expert Users

How to read mail attachement

I want to read attachements sent to unix mail id and save the attachement in folder. I may receive the mails from different mail clients(outlook, lotus ..etc). Attachements are in CSV(comma saperate) format. Let me know the shell script code for this. Regards, Venkat (1 Reply)
Discussion started by: svenkatareddy
1 Replies

7. UNIX for Dummies Questions & Answers

How do I read mail in /var/spool/mail?

How can I read mail sent to /var/spool/mail? I do not have pine installed so forget about that...is there some generic utility I can use? (3 Replies)
Discussion started by: mojoman
3 Replies

8. Shell Programming and Scripting

script to read from mail

Hi, I have a requirement in which I have to read mail from a unix text file and scan records having failed records (any number > 0) Firstly it should compare the file creation_date with sysdate if the dates match then do the checking for failed records sample file i/p Staged 0... (0 Replies)
Discussion started by: misenkiser
0 Replies

9. UNIX for Dummies Questions & Answers

How to mark ALL mail items as read?

Hi guys. Does anyone know if there is a mail command that will allow you to flag all mail items as being read? I've checked out the man mail pages, but can't seem to find what I'm looking for. :confused: We are running UNIX AIX 5.2. Thanks in advance, Kev (3 Replies)
Discussion started by: Krispy
3 Replies

10. UNIX for Dummies Questions & Answers

Tell UW-Imap to read /var/mail/mailbox ??

Hi, I've got UW-IMAP installed on Gentoo. I'm using EXIM as the transfer agent. EXIM is working fine (I think)... all incoming mail - external and internal goes to /var/mail/username file. I can verifiy this by reading this file directly with nano. Also, IMAPd is running. It lets me login... (2 Replies)
Discussion started by: d11wtq
2 Replies

Featured Tech Videos