Salesforce

How do I change the sendmail 'from' address and domain on the appliance emails?

« Go Back
Information
000004131
All emails from the Unitrends appliance comes from a non-existent domain. This article will summarize how to change the domain, as well as, how to change the 'from' sender address in sendmail.
Details
For 10.0+ you may be able to use the INI value.  If not, proceed to the detailed section.





Emails from the Unitrends appliance are being refused by the local email server since they come from a non-existent email domain.
 
In version 10.0+ simply edit the master.ini
vi /usr/bp/bpinit/master.ini

[Reports]
  PageWidth=80
  PageLength=60
  WeeklySummaryName=weekly.rpt
  FailureReportName=failure.rpt
  TapeContentName=tape.rpt
  ;ReportFrom=root@localhost.localdomain  ; Specify user to send reports as
Uncomment the ;ReportFrom= line by removing the comma and  the email address and modify the email address.
ReportFrom=reportuser@unitrends.com
Save this file, then restart the sendmail services:  service sendmail restart

--This ONLY works for reports, not tests/sendmail directly --

To test report function after above change run the following
php /usr/bp/bin/genreports.php



Instructions below are only for systems older than release 10.x, or used for systems requiring more detailed steps:

For the appliance to send email from user@company.com instead of report@appliance.domain.com, your domain name must be configured in sendmail.cf.

To change the sender for all reports from a Unitrends appliance to a single sender, perform the following:

  • SSH into the appropriate appliance and navigate to /etc/mail
cd /etc/mail
  • Create a backup copy of your sendmail.cf and sendmail.mc files.
cp sendmail.cf sendmail.mc /root
  • ​We now have enable the genericstable feature for sendmail and compile our new configuration file.  You will need to add these lines to the sendmail.mc file.  Also make sure the smart host that is defined is their relay server.  Once you rebuild the sendmail.mc the DS record will be removed if the smart host is not defined.
define(`SMART_HOST',`smtp.mydomain.com')dnl
FEATURE(`genericstable',`hash -o /etc/mail/genericstable.db')dnl 
GENERICS_DOMAIN_FILE(`/etc/mail/generics-domains')dnl
  • ​ Added these directives to the end of the sendmail.mc file just before the MAILER directives.  Original last 10 lines of the sendmail.mc
[root@UB mail]# tail -n 12 sendmail.mc
dnl #
dnl FEATURE(masquerade_entire_domain)dnl
dnl #
dnl MASQUERADE_DOMAIN(localhost)dnl
dnl MASQUERADE_DOMAIN(localhost.localdomain)dnl
dnl MASQUERADE_DOMAIN(mydomainalias.com)dnl
dnl MASQUERADE_DOMAIN(mydomain.lan)dnl
MAILER(smtp)dnl
MAILER(procmail)dnl
dnl MAILER(cyrusv2)dnl
  • ​ After making the changes:
[root@UB mail]# tail -n 12 sendmail.mc
dnl #
dnl MASQUERADE_DOMAIN(localhost)dnl
dnl MASQUERADE_DOMAIN(localhost.localdomain)dnl
dnl MASQUERADE_DOMAIN(mydomainalias.com)dnl
dnl MASQUERADE_DOMAIN(mydomain.lan)dnl
define(`SMART_HOST',`smtp.mydomain.com')dnl
FEATURE(`genericstable',`hash -o /etc/mail/genericstable.db')dnl
GENERICS_DOMAIN_FILE(`/etc/mail/generics-domains')dnl
MAILER(smtp)dnl
MAILER(procmail)dnl
dnl MAILER(cyrusv2)dnl
define(`MAIL_HUB', `skynet.gov.')dnl
define(`LOCAL_RELAY', `skynet.gov.')dnl
  • ​ Now lets create the new configuration file:
[root@UB mail]# m4 sendmail.mc > sendmail.cf
  • ​Create a /etc/mail/generics-domains file that is just a list of all the domains that should be inspected. Make sure the file includes the domain name used by the Unitrends appliance, which you can obtain using the command:
sendmail -bt -d0.1 </dev/null
  • ​Here is a sample  /etc/mail/generics-domains file:
[root@UB mail]# cat /etc/mail/generics-domains
unitrends.com
  • ​Create your /etc/mail/genericstable file. First sendmail searches the /etc/mail/generics-domains file for a list of domains to reverse map. It then looks at the /etc/mail/genericstable file for an individual email address from a matching domain. The format of the file is linux-username username@new-domain.com.  Here is an example:
[root@UB mail]# cat /etc/mail/genericstable
root            terminator@skynet.gov
reports         terminator@skynet.gov
Failure.Report  terminator@skynet.gov
Schedule.Report terminator@skynet.gov
  • ​If Unitrends release 9.1.1 or earlier, fix the mail_report.php with this sed command
 [root@UB mail]# sed -i 's/mail(\x27\x27, $subject,\x27\x27,$email);/mail(\x27\x27, $subject,\x27\x27,$email,"-f \x27$from\x27");/g' /usr/bp/bin/mail_report.php
  • Ensure that the domain you're sending from is defined as an alias for the appliance in /etc/hosts and host entry defined for the SMTP relay as your domain with a trailing period.
[root@UB ~]# cat /etc/hosts
127.0.0.1      localhost.localdomain localhost
192.168.0.5    skynet.gov UB.skynet.gov UB
192.168.0.45   skynet.gov.
  • Ensure that the ReportFrom parameter is defined
[root@UB ~]  bputil -p "Reports" "ReportFrom" "reports@skynet.com" /usr/bp/bpinit/master.ini
  • ​The last step is to restart sendmail
service sendmail restart
  • Verify emails are being sent with the proper "from" address. This can be done using telnet and some basic SMTP commands seen below in bold and verifying that you received the email.
[root@UB ~]# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 skynet.gov ESMTP Sendmail 8.14.4/8.14.4; Sat, 5 Aug 2017 11:06:20 -0500
EHLO localhost
250-skynet.gov Hello localhost.localdomain [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
MAIL FROM: root@skynet.gov
250 2.1.0 root@skynet.gov... Sender ok
RCPT TO: your@emailaddress.com
250 2.1.5 your@emailaddress.com... Recipient ok
DATA
354 Enter mail, end with "." on a line by itself
Test email
.
250 2.0.0 v75G6KrM031870 Message accepted for delivery
^]
telnet> quit
Connection closed.
DNS and /etc/hosts must agree on the FQDN. There may be issues if there is an internal and an external domain name.

Many of the changes in this KB are made using the program "vi," for more information on how to use this please refer to this documentation
 
Meta
David McCraw
Stephen Chandler

Powered by