Sponsored Content
Top Forums Shell Programming and Scripting Sending Mail via shell script Post 302655301 by bakunin on Wednesday 13th of June 2012 04:14:31 AM
Old 06-13-2012
Quote:
Originally Posted by ldapguy
How do I add that to my script so that it goes through the IP to send the email?
Short answer: you shouldn't.

Long version: it is simply not the task of a script to "know how to deliver mails". This should be the knowledge of the mailing daemon and be configured there. "mail" (which you use in your script) is a client program which acts as a frontend to this delivery system: it takes a mail message with all relevant information (addressee, content, subject line, etc.) and passes this to a daemon (sendmail, whatever), which should deliver this to an MTA (mail transfer agent) or to the addressees systems mail service directly. In any case your script should not be concerned with how mail gets there.

To use an analogy: if you want to use any other IP service (say, FTP) in your script, it shouldn't be concerned in dealing with IP routing or something such either - this would be the job of routers, so let them do it.

Bottom line: configure your "sendmail" or whatever you use to send mails properly and leave your perfectly written script alone.

I hope this helps.

bakunin
 

10 More Discussions You Might Find Interesting

1. HP-UX

sending mail from a script

Hi I want to send a mail (to my id like abc@xyz.com) from a shell script running on HP Ux. Would like to include text from a file or include the file as attachment, either ways. Thanks Sidhu (6 Replies)
Discussion started by: Amardeep
6 Replies

2. Shell Programming and Scripting

sending a mail using shell script

Please help me in writing the script for sending an attachment through email.(For example my text file name is :abc.txt and it is in directory d:/abc) (1 Reply)
Discussion started by: anitha126
1 Replies

3. Shell Programming and Scripting

Shell script for sending automatic email to personal mail id

hi guys, I need a shell script to send mail automatically to my personal mail id like xxxx@hotmail.com but while experimenting with "mail" command I faced following problems. cat text1.txt | mail -s 'test mail' xxxx@hotmail.com command successfully executed but while checking for... (4 Replies)
Discussion started by: rrd1986
4 Replies

4. Linux

Memory monitoring and sending alert mail to users in network using shell script

i m workiing on a shell script which may monitors network memory and send alert to user if it increase a threshold (1 Reply)
Discussion started by: navdeep5673
1 Replies

5. Shell Programming and Scripting

Reading a file and sending mail by shell scripting?

hi I need help urgently...i need to write a shell script which can solve the following problem....its urgent plz help me out coz m totally newbie in shell scripting.... the problem is: Suppose I have a folder called logs. whenever some error occurs some correspondence error file is generated. I... (4 Replies)
Discussion started by: sukhdip
4 Replies

6. Shell Programming and Scripting

Shell script for creating log file and sending mail?

Hi , I am trying to create shell script which will help me to compare file name in two folder. There is a multiple file store in 2 folder.I want to compare that with the name. If all the file are same then send a mail that "all date is same" if not then create one log file which contain... (4 Replies)
Discussion started by: san_dy123
4 Replies

7. Shell Programming and Scripting

shell script not sending mail

Hi, I have shell script which checks the filesystem check but does not send the mail. I might be missing something very simple.. could you please help? #!/bin/sh _servers="machine name" _out="/tmp/output.$$" _email="me@there.com" _sub="Disk Space Report $(date)" _mail=/usr/bin/mail... (5 Replies)
Discussion started by: Pandee
5 Replies

8. Shell Programming and Scripting

Sending mail from shell script

Hello All, I m trying to send mail from my unix script, I have used the below command mailx -s 'hi' email address < temp.txt It is not giving me any error,but I couldn't receive the mail Can you please help me. Many Thanks, Pragyan (6 Replies)
Discussion started by: prarat
6 Replies

9. Shell Programming and Scripting

Configuring smtp settings and then sending the mail through shell script

I have make an menu in which first option is to start and second is to stop the services echo "Please enter the appropriate choice for doing the operations" echo " 1) STOP Services 2) START Services case $choice in 1) ... (1 Reply)
Discussion started by: punpun66
1 Replies

10. Shell Programming and Scripting

A shell script for checking the last image and sending it in attachment to mail

Hello every one. I use mutt : "mpack -s "Test" /home/pi/Pictures/2018-10-05_23_10_40.jpg my_email_addres " to send me a particular picture with the name of the data+jpg in a pictures folder, but this folder I use it for a timelapse proyect with more pictures , and what I need is... (2 Replies)
Discussion started by: maxbcn
2 Replies
SHOWQ(8)						      System Manager's Manual							  SHOWQ(8)

NAME
showq - list the Postfix mail queue SYNOPSIS
showq [generic Postfix daemon options] DESCRIPTION
The showq daemon reports the Postfix mail queue status. It is the program that emulates the sendmail `mailq' command. The showq daemon can also be run in stand-alone mode by the super-user. This mode of operation is used to emulate the `mailq' command while the Postfix mail system is down. SECURITY
The showq daemon can run in a chroot jail at fixed low privilege, and takes no input from the client. Its service port is accessible to local untrusted users, so the service can be susceptible to denial of service attacks. STANDARDS
None. The showq daemon does not interact with the outside world. DIAGNOSTICS
Problems and transactions are logged to syslogd(8). BUGS
The showq daemon runs at a fixed low privilege; consequently, it cannot extract information from queue files in the maildrop directory. SEE ALSO
cleanup(8) canonicalize and enqueue mail pickup(8) local mail pickup service qmgr(8) mail being delivered, delayed mail syslogd(8) system logging LICENSE
The Secure Mailer license must be distributed with this software. AUTHOR(S) Wietse Venema IBM T.J. Watson Research P.O. Box 704 Yorktown Heights, NY 10598, USA SHOWQ(8)
All times are GMT -4. The time now is 10:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy