Sponsored Content
Full Discussion: Help needed to send email
Top Forums Shell Programming and Scripting Help needed to send email Post 302418482 by sithara on Tuesday 4th of May 2010 11:44:49 AM
Old 05-04-2010
Help needed to send email

Hi ,

Below is the part of Ksh.I have written.

The sql below generates list of records for undelivered letters.

## - spool undelivered letter list
cd $cs_LOG
$ORACLE_BIN/sqlplus $USER/$PASS @$cs_PROG/spool_undelivered_letters.sql

The below Ksh check for the file and send emails.

##if log file is not empty save it with the date and send email
if [ ! -s $cs_LOG/undelivered_letters.log ]; then
echo 'all letters delivered'
else
cp $cs_LOG/undelivered_letters.log $cs_LOG/undelivered_letters_age29.log.`date +%Y%m%d`
echo 'Undelivered letters check cust serv letters log directory ' `date` | /usr/bin/mailx \
-c test@yahoo.com \
-r eletters@xxx.com \
-s 'Undelivered letters' \
test@yahoo.com;
fi


But My problem is even though the spool does not contain any data it sends email.

The requirement is if undelivered_letters.log does not contain any data then we are not supposed to send the email.If it has data then we sould send email.
 

8 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Unable to send eMail from a UNIX-Host ( using mailx ) to a Outlook-email-addres(Win)

Hi A) I am able to send eMail using mailx from a UNIX ( solaris 8 ) host to my Outlook-email-ID : FName.Surname@Citigroup.com ( This is NOT my actual -eMail-ID). But in Outlook the "From :" eMail address is displayed as " usr1@unix-host1.unregistered.email.citicorp.com " .i.e the words... (2 Replies)
Discussion started by: Vetrivela
2 Replies

2. UNIX for Dummies Questions & Answers

Send email where # is in the email address - Using Unix

Hi All, How do I send an email using malix where email address contains a #. I have a email address like this : #test@test.com I want to send email like malix -s "TEST" #test@test.com < SOMEFILE I tried \# but doesn't work. Please let me know how we can achieve this? I am in... (1 Reply)
Discussion started by: jingi1234
1 Replies

3. Solaris

Send an email from Solaris using Linux email server

Hello everyone I have a problem and I need your help: I have a Solaris 10 and Solaris 8 UNIX Servers, and Linux Centos4 as email server. I need send an email from Solaris servers preferably using Centos4 email server. I have no mail service configured in my Solaris computers (1 Reply)
Discussion started by: aflores
1 Replies

4. Shell Programming and Scripting

Help needed to send email

Hi , Below is the part of Ksh.I have written. The sql below generates list of records for undelivered letters. ## - spool undelivered letter list cd $cs_LOG $ORACLE_BIN/sqlplus $USER/$PASS @$cs_PROG/spool_undelivered_letters.sql The below Ksh check for the file and send emails. ... (3 Replies)
Discussion started by: sithara
3 Replies

5. Shell Programming and Scripting

Script to send email after comparing the folder permissions to a certain permission & send email

Hello , I am trying to write a unix shell script to compare folder permission to say drwxr-x-wx and then send an email to my id in case the folders don't have the drwxr-x-wx permissions set for them . I have been trying to come up with a script for few days now , pls help me:( (2 Replies)
Discussion started by: nairshar
2 Replies

6. UNIX for Dummies Questions & Answers

new to ldap, send email to a ou or group, and see a list from email client

hi, i'm running openldap on ubuntu 10.04, creating new items with apache directory studio (windows version). i use the ldap just as an address book to our small office (email clients are windows live mail 2009, 2011, microsoft outlook 2007 and 2010). a. i cant see a list of the contacts,... (0 Replies)
Discussion started by: V4705
0 Replies

7. Shell Programming and Scripting

send email to email id which is having # symbol

Hi, I have one requirement to send email to email id which is having # ( in the begining of the email id). I'm using mailx command to send an email. But not receiving those emails, but email status is showing email sent successful. Code which i'm using is : cat file1.txt | mailx -s... (3 Replies)
Discussion started by: latika
3 Replies

8. SuSE

Send outgoing email to my GroupWise email

Dear users, I have Linux server whose versions are Suse 10 SP 3 and Suse 11. I am trying to send email from these servers to my GroupWise email account. In /etc/postfix/main.cf file, The current value of MYHOSTNAME is LINUX.LOCAL. What should be the right value of MYHOSTNAME? Is... (0 Replies)
Discussion started by: JDBA
0 Replies
LAMSON(1)																 LAMSON(1)

NAME
Lamson - Lamson is a modern Pythonic mail server built like a web application server. SYNOPSIS
lamson <action> [options] DESCRIPTION
lamson is a pure Python SMTP server designed to create robust and complex mail applications in the style of modern web frameworks such as Django. Unlike traditional SMTP servers like Postfix or Sendmail, Lamson has all the features of a web application stack (ORM, templates, routing, handlers, state machines, Python) without needing to configure alias files, run newaliases, or juggle tons of tiny fragile pro- cesses. Lamson also plays well with other web frameworks and Python libraries. ACTIONS
log [-port PORT] [-host HOST] [-pid PIDFILE] [-chroot True|False] [-chdir DIR] [-umask UMASK] [-uid UID] [-gid GID] [-FORCE True|False] Runs a logging only server on the given hosts and port. It logs each message it receives and also stores it to the run/queue so that you can make sure it was received in testing. lamson log -port 8825 -host 127.0.0.1 -pid ./run/log.pid -chroot False -chdir "." -umask False -uid False -gid False -FORCE False If you specify a uid/gid then this means you want to first change to root, set everything up, and then drop to that UID/GID combina- tion. This is typically so you can bind to port 25 and then become "safe" to continue operating as a non-root user. If you give one or the other, this it will just change to that uid or gid without doing the priv drop operation. send [-port PORT] [-host HOST] [-debug 0|1] [-sender EMAIL] [-to EMAIL] [-subject SUBJECT] [-body BODY] [-attach FILENAME] Sends an email to someone as a test message. See the sendmail command for a sendmail replacement. lamson send -port 8825 -host 127.0.0.1 -debug 1 -sender EMAIL -to EMAIL -subject STR -body STR -attach False' sendmail [-port PORT] [-host HOST] [-debug 0|1] -- [RECIPIENTS] Used as a testing sendmail replacement for use in programs like mutt as an MTA. It reads the email to send on the stdin and then delivers it based on the port and host settings. lamson sendmail -port 8825 -host 127.0.0.1 -debug 0 -- [recipients] start [-pid PIDFILE] [-FORCE True|False] [-chroot True|False] [-chdir DIR] [-umask UMASK] [-uid UID] [-gid GID] [-boot BOOTMODULE] Runs a lamson server out of the given directory. lamson start -pid ./run/smtp.pid -FORCE False -chroot False -chdir "." -umask False -uid False -gid False -boot config.boot stop [-pid PIDFILE] [-KILL True|False] [-ALL DIR] Stops a running lamson server. Give -KILL True to have it stopped violently. The PID file is removed after the signal is sent. Give -ALL the name of a run directory and it will stop all pid files it finds there. lamson stop -pid ./run/smtp.pid -KILL False -ALL False restart [-pid PIDFILE] [-FORCE True|False] [-chroot True|False] [-chdir DIR] [-umask UMASK] [-uid UID] [-gid GID] [-boot CONFIG] [-KILL True|False] [-ALL DIR] Simply attempts a stop and then a start command. All options for both apply to restart. status [-pid PIDFILE] Prints out status information about lamson useful for finding out if it's running and where. lamson status -pid ./run/smtp.pid queue [-pop|-get|-remove|-count|-clear|-keys] [-name QUEUE] Let's you do most of the operations available to a queue. lamson queue (-pop | -get | -remove | -count | -clear | -keys) -name run/queue routes [-path PATH] -- [CONFIG] [-test EMAIL] Prints out valuable information about an application's routing configuration after everything is loaded and ready to go. Helps debug problems with messages not getting to your handlers. Path has the search paths you want separated by a ':' character, and it's added to the sys.path. lamson routes -path $PWD -- config.testing -test "" It defaults to running your config.testing to load the routes. If you want it to run the config.boot then give that instead: lamson routes -- config.boot You can also test a potential target by doing -test EMAIL. gen [-project NAME] Generates various useful things for you to get you started. lamson gen -project STR spell [-language LANG] -- [FILES] Runs the PyEnchant spell checker on the given file. Use this to train the spell checker for unit test runs when new words show up. lamson spell -langauge en_US -- [files] It will run interactively and if you perform an edit on the file it will save your changes back to the file and make a backup named with .bak. web [-basedir DIR] [-port PORT] [-host HOST] Starts a very simple files only web server for easy testing of applications that need to make some HTML files as the result of their operation. If you need more than this then use a real web server. lamson web -basedir "." -port 8888 -host '127.0.0.1' This command doesn't exit so you can view the logs it prints out. cleanse [-input MAILBOX] [-output MAILBOX] Uses Lamson mail cleansing and canonicalization system to take an input maildir (or mbox) and replicate the email over into another maildir. It's used mostly for testing and cleaning. blast [-input MAILBOX] [-port PORT] [-host HOST] [-debug 0|1] Given a maildir, this command will go through each email and blast it at your server. It does nothing to the message, so it will be real messages hitting your server, not cleansed ones. version Prints the version of Lamson, the reporitory revision, and the file it came from. help [-for CMD] Prints out help for the commands. lamson help You can get help for one command with: lamson help -for STR SEE ALSO
Full documentation for lamson can be found at http://lamsonproject.org BUGS
Please report bugs at https://bugs.launchpad.net/lamson AUTHOR
This manual page was written by David Watson <david@kutoken.com> 25 August 2009 LAMSON(1)
All times are GMT -4. The time now is 09:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy