Sponsored Content
Top Forums Shell Programming and Scripting How to display HOSTNAME in sendmail? Post 302996354 by mohtashims on Monday 24th of April 2017 05:13:13 PM
Old 04-24-2017
Hammer & Screwdriver How to display HOSTNAME in sendmail?

I have two issues with my script one of which i would like to discuss here.

Its my compulsion to use sendmail.

My sample script

Code:
#!/bin/bash

{
        print 'From: Prod@`hostname`.mycomp.com'
        print 'To: me@mycomp.com'
        print 'MIME-Version: 1.0'
        print 'Content-Type: text/html'
        print 'Subject: Usage Report'
        print ''
        print '<html>'
        print '<body>'
        print '<p>Today Usage Report for Server</p>'

        print '</body>'
        print '</html>'
} | /usr/sbin/sendmail -t

Wehn i run the above with debug mode i see that the hostname is not substituted in the From of the email.

i also tried the below in vain

Code:
print 'From: Prod@$hostname.mycomp.com'

Code:
uname -a
SunOS myhost 5.11 11.3 sun4u sparc SUNW,SPARC-Enterprise

Can you please suggest something that works with both bash and ksh shells ?
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Solaris - unknown hostname - how can I change hostname?

Hello, I am new to Solaris. I am using stand alone Solaris 10.0 for test/study purpose and connecting to internet via an ADSL modem which has DHCP server. My Solaris is working on VMWare within winXP. My WinXP and Solaris connects to internet by the same ADSL modem via its DHCP at the same... (1 Reply)
Discussion started by: XNOR
1 Replies

2. Solaris

How to display hostname in command prompt

Anyone know How to configure solaris 8 to display hostname in command prompt , everytime when you open a terminal screen . (3 Replies)
Discussion started by: civic2005
3 Replies

3. Emergency UNIX and Linux Support

HP UX - ILO Console hostname different than Machine Hostname...

Hi All, So we added a new HP-UX 11.31 machine. Copied OS via Ignite-UX (DVD)over from this machine called machine_a. It was supposed to be named machine_c. And it is when you log in...however when I'm in the ILO console before logging in, it says: It should say: What gives? And how do... (4 Replies)
Discussion started by: zixzix01
4 Replies

4. Solaris

Classic: sendmail[pid]: My unqualified host name (hostname) unknown

Hi all, I'd like to disable sendmail permanently on my "new" 220R with freshly installed SunOS 5.10 because it prints annoying messages to the system console. Also I'm interested in how to fix the actual problem with unqualified host name. My unqualified host name (hostname) unknown; sleeping... (2 Replies)
Discussion started by: pseudocoder
2 Replies

5. UNIX for Advanced & Expert Users

AIX - Sendmail - add hostname to subject of outgoing mail

Hello, I'm configuring sendmail on an AIX 7.1 server (bos.net.tcp.client 7.1.1.15). I've gotten sendmail to send mail through our Novell GroupWise server, so that mail from a user on the server appears to come from their GroupWise account, and replies to the email would go to their GroupWise... (0 Replies)
Discussion started by: eyebeam
0 Replies

6. UNIX for Dummies Questions & Answers

nLocal sendmail issues when hostname not set in official domain name

Hi, I'm having issues with sendmail when I try to send host to host mail. I've had to change the "my official domain name" line to mycompany.com to get the mails through the external spam filter, when a mail was sent with hostname.mycompany.com it was blocked. I had to change the Dj macro... (0 Replies)
Discussion started by: elcounto
0 Replies

7. UNIX for Advanced & Expert Users

Sendmail questions, SCO 5.0.6 sendmail 8.11.0

I am running SCO 5.0.6 and using sendmail 8.11.0 and having issues with smtp authentication. When trying to send mail the following message will kick back. (reason: 530 5.7.1 Authentication required) 530 5.7.1 Authentication required Not sure what needs to be tweeked in sendmail.cf but I... (1 Reply)
Discussion started by: ziggy6
1 Replies

8. UNIX for Advanced & Expert Users

Hostname -f hostname: Unknown host

deleted (0 Replies)
Discussion started by: hce
0 Replies

9. Solaris

Clarifying sendmail configuration - sendmail-client offline

Hi all, I have read about sendmail running as 2 separate process. 1 as a MSP, and the other as the real daemon or MTA. In my current configuration, the sendmail-client is disabled. Both submit.cf and sendmail.cf are left as default untouch I do not specified any mailhost... (3 Replies)
Discussion started by: javanoob
3 Replies
PMDASENDMAIL(1) 					      General Commands Manual						   PMDASENDMAIL(1)

NAME
pmdasendmail - sendmail performance metrics domain agent (PMDA) SYNOPSIS
$PCP_PMDAS_DIR/sendmail/pmdasendmail [-d domain] [-l logfile] [-U username] DESCRIPTION
pmdasendmail is a sendmail Performance Metrics Domain Agent (PMDA) which exports mail traffic statistics as collected by sendmail(1). Before the sendmail PMDA can export any metrics, sendmail(1) must have statistics collection enabled. This involves checking the name of the statistics file, as given by the OS or O StatusFile control lines in /etc/sendmail.cf, and then creating this file if it does not already exist. Removing the file will terminate statistics collection by sendmail(1) and hence the sendmail PMDA. A brief description of the pmdasendmail command line options follows: -d It is absolutely crucial that the performance metrics domain number specified here is unique and consistent. That is, domain should be different for every PMDA on the one host, and the same domain number should be used for the same PMDA on all hosts. -l Location of the log file. By default, a log file named sendmail.log is written in the current directory of pmcd(1) when pmdasendmail is started, i.e. $PCP_LOG_DIR/pmcd. If the log file cannot be created or is not writable, output is written to the standard error instead. -U User account under which to run the agent. The default is the unprivileged "pcp" account in current versions of PCP, but in older versions the superuser account ("root") was used by default. There are no communication options, as the Install script ensures the sendmail PMDA will be connected to PMCD by a pipe. INSTALLATION
If you want access to the names, help text and values for the sendmail performance metrics, do the following as root: # cd $PCP_PMDAS_DIR/sendmail # ./Install If you want to undo the installation, do the following as root: # cd $PCP_PMDAS_DIR/sendmail # ./Remove pmdasendmail is launched by pmcd(1) and should never be executed directly. The Install and Remove scripts notify pmcd(1) when the agent is installed or removed. FILES
$PCP_PMCDCONF_PATH command line options used to launch pmdasendmail $PCP_PMDAS_DIR/sendmail/help default help text file for the sendmail metrics $PCP_PMDAS_DIR/sendmail/Install installation script for the pmdasendmail agent $PCP_PMDAS_DIR/sendmail/Remove undo installation script for the pmdasendmail agent $PCP_LOG_DIR/pmcd/sendmail.log default log file for error messages and other information from pmdasendmail /etc/sendmail.cf sendmail configuration file to identify the name of the statistics file PCP ENVIRONMENT
Environment variables with the prefix PCP_ are used to parameterize the file and directory names used by PCP. On each installation, the file /etc/pcp.conf contains the local values for these variables. The $PCP_CONF variable may be used to specify an alternative configura- tion file, as described in pcp.conf(5). SEE ALSO
pmcd(1) and sendmail(1). Performance Co-Pilot PCP PMDASENDMAIL(1)
All times are GMT -4. The time now is 01:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy