03-20-2015 01:37 AM
Going through the TN
http://www.symantec.com/business/support/index?page=content&id=TECH24110
Do I need to use third party tool to relay mails to the e-mail gateway ?
Is there any other way arounf for Windows ?
Solved! Go to Solution.
04-18-2015 01:30 AM
Any news?
BTW - another forum member has kindly posted an example of a VBscript to send emails via SMTP call to a Microsoft object. The posted example does not do attachments, but I'm sure that you could work that bit out.
https://www-secure.symantec.com/connect/forums/email-notifications-without-blat
03-20-2015 01:48 AM
> Do I need to use third party tool to relay mails to the e-mail gateway ?
Yes it mentions in that technote that you need to install and configure Blat for this purpose.
Following that technote should work fine.
03-20-2015 02:48 AM
You do not 'have to' use blat. You could use any script or tool within mail_dr_info.cmd that can send emails. The things that you must do, are:
1) Place your email logic inside a script named 'mail_dr_info.cmd' in the apporporiate folder.
2) The mail_dr_info.cmd script AND everything within it absolutely MUST run silently - i.e. absolutely no output generated to stdout or stderr - otherwise the component of NetBackup that calls 'mail_dr_info.cmd' gets confused and thinks that the call to mail_dr_info.cmd has failed in someway.
03-20-2015 02:49 AM
As a basic minimum you need to do this:
1) Where 'someone@whocares.com' is the target email address, and 'x.x.x.x' is the IP address of your SMTP gateway:
copy "D:\Program Files\Veritas\NetBackup\bin\goodies\nbmail.cmd" "D:\Program Files\Veritas\NetBackup\bin\mail_dr_info.cmd"
notepad "D:\Program Files\Veritas\NetBackup\bin\mail_dr_info.cmd"
...replace -server WARTHOG ...with -server X.X.X.X
...replace -i NetBackup ...with -i someone@whocares.com
...and uncomment the mid section of code, i.e. remove the REM, but keep the leading @, from these five lines of code:
@IF "%~4"=="" (
@blat %3 -s %2 -t %1 -i someone@whocares.com -server x.x.x.x -q
@) ELSE (
@blat %3 -s %2 -t %1 -i someone@whocares.com -server x.x.x.x -q -attach %4
@)
...click save, to save your changes.
2) However, I prefer to use a script like this, so that I can have a log of the parameters that mail_dr_info.cmd actually receives from NetBackup AND a log of whether the email send actually worked or not, so maybe something like this:
@echo off setlocal enabledelayedexpansion REM ************************************************************************************** REM * File: mail_dr_info.cmd REM * Desc: Called by NetBackup to email the status of the catalog backup... REM * ...and attach the DR file if the catalog backup is successful. REM * REM * Vers Date Who Description REM * ---- ---- --- ----------- REM * v0.1 20-MAY-2013 sdo Original version. REM * v0.2 03-SEP-2013 sdo P4 = "(null)" if there is no DR file. REM ************************************************************************************** set z_path=%~dp0 set z_name=%~n0 set z_file_log=!z_path!!z_name!.log set /a z_sts=0 REM %1 is the recipient's address REM %2 is the subject line REM %3 is the message file name REM %4 is the attached file name echo+ >>"!z_file_log!" echo P1 = %1 >>"!z_file_log!" echo P2 = %2 >>"!z_file_log!" echo P3 = %3 >>"!z_file_log!" echo P4 = %4 >>"!z_file_log!" if "%~4"=="(null)" ( call :log "Emailing without attachment..." blat %3 -s %2 -t %1 -i someone@whocares.com -server x.x.x.x -q >>"!z_file_log!" 2>&1 set z_sts=!errorlevel! call :log "...blat status `!z_sts!`..." ) else ( call :log "Emailing with attachment..." blat %3 -s %2 -t %1 -i someone@whocares.com -server x.x.x.x -attach %4 -q >>"!z_file_log!" 2>&1 set z_sts=!errorlevel! call :log "...blat status `!z_sts!`..." ) :end exit /b !z_sts! :log (echo !date! !time:~0,8! %~1)>>"!z_file_log!" goto :eof
3) Here's a tip - at some point, and I'm sorry but I can't remember which version - NetBackup changed from sending P4 = "" to sending P4 = "(null)" (when there is no DR file to attach) - so, basically, you may have to change the statement in the script from:
if "%~4"=="(null)" (
...to:
if "%~4"=="" (
HTH.
03-20-2015 04:53 AM
What issues are you facing . Have you tried configuring it as mentioned in TN.
To allow NBU to send alerts to you, firstly you need to allow NBU server ip IN YOUR messaging environment (in case of exchange simply add it in receive connector with accept anonymous permissions)
Install and configure BLAT on NBU server specify SMTP server details and mention nbu server hostname/ip (details are given in TN)
Open 25 port if NBU server and SMTP has firewall in between by anychance.
03-23-2015 06:28 AM
I cannot use BLAT.exe thrid party tool in my environment.
I'm using -
System.Net.Mail.MailMessage to create mail message
System.Net.Mail.SmtpClient to send mail
I put everything in a file.ps1
I'm invoking the PS with four parameters from the file mail_dr_info.cmd in /netbackup/bin
However look like the mail_dr_info.cmd actually is not getting invoked.
03-23-2015 06:48 AM
Here's my notes re testing PS:
03-23-2015 06:49 AM
I did below entry at the last in dr_file_info.cmd to check, it actually works. Looks like NB is not touching it.
Any suggestions ?
@REM - )
@REM -
@REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
echo %1 >> test.txt 2>> test2.txt
echo %2 >> test.txt 2>> test2.txt
echo %3 >> test.txt 2>> test2.txt
echo %4 >> test.txt 2>> test2.txt
@REM powershell.exe "E:\Program Files\Veritas\NetBackup\bin\mailer.ps1" %1 %2 %3 %4
03-23-2015 06:58 AM
Apologies, I don't understand the 'NB is not touching it' point? Please re-explain?
Maybe your dr_file_info.cmd should be renamed to mail_dr_info.cmd ?
03-23-2015 07:04 AM
let me correct the post -
mail_dr_info.cmd - it is the file inside /netbackup/bin
I don't understand the 'NB is not touching it' point? Please re-explain? - I meant NB is neither invoking it nor passing any parameter to it. I echoed the parameter to see what are the parameters getting passed to it.
03-23-2015 07:24 AM
Try these, so that there is at least something to echo (even if the parameters are empty) - i.e. echo does not like printing nothing, and actually causes output of "echo is on/off."
So maybe try:
echo P1 = %1 >>"test.txt" 2>&1
echo P2 = %2 >>"test.txt" 2>&1
echo P3 = %3 >>"test.txt" 2>&1
echo P4 = %4 >>"test.txt" 2>&1
How are you testing? By actually running a catalog backup?
Remember the "mail_dr_info.cmd" is executed by the parent process which is probably running as NT_System_Authority - but 'where' is its 'default directory' while it is running? Maybe the file "test.txt" is being created in some other folder and not where you expect it to be?
So maybe try:
echo P1 = %1 >>"E:\temp\test.txt" 2>&1
echo P2 = %2 >>"E:\temp\test.txt" 2>&1
echo P3 = %3 >>"E:\temp\test.txt" 2>&1
echo P4 = %4 >>"E:\temp\test.txt" 2>&1
03-23-2015 08:00 AM
Tried running by modifying mail_dr_info.cmd -
echo P1 = %1 >>"E:\temp\test.txt" 2>&1
echo P2 = %2 >>"E:\temp\test.txt" 2>&1
echo P3 = %3 >>"E:\temp\test.txt" 2>&1
echo P4 = %4 >>"E:\temp\test.txt" 2>&1
Nothing is there inside E:\temp\
Looks like NB even not firing mail_dr_info.cmd
03-23-2015 08:04 AM
Tried below by modifying mail_dr_info.cmd
echo P1 = %1 >>"E:\temp\test.txt" 2>&1
echo P2 = %2 >>"E:\temp\test.txt" 2>&1
echo P3 = %3 >>"E:\temp\test.txt" 2>&1
echo P4 = %4 >>"E:\temp\test.txt" 2>&1
Nothing came inside E:\temp.
May be mail_dr_info.cmd is not getting invoked by NB ? Any setting that I need to check ?
03-23-2015 08:30 AM
echo P1 = %1 >>"E:\temp\test.txt" 2>&1
echo P2 = %2 >>"E:\temp\test.txt" 2>&1
echo P3 = %3 >>"E:\temp\test.txt" 2>&1
echo P4 = %4 >>"E:\temp\test.txt" 2>&1
tried this - nothing came inside E:\temp
03-23-2015 09:00 AM
Are you running a catalog backup to test this?
Have you configured email properties in "Disaster Recovery" tab in the catalog backup policy?
03-24-2015 02:14 AM
Yes I'm running catalog backup to test this.
Yes I specified the email properties in the DR tab in the catalog backup policy.
03-24-2015 03:37 AM
What does the whole of your script:
E:\Program Files\Veritas\NetBackup\bin\mail_dr_info.cmd
...look like? Can you post it as text?
04-04-2015 04:05 PM
Did you get this to work in the end?
If yes, what was your solution?
If no, can I help?
04-04-2015 11:24 PM
04-06-2015 01:23 AM
My apologies for replying late. It is still not solved. I opened an official case with Symantec on this.
Here is the PS script -
Pardon me for writing this big. PS has Send-MailMessage command to do this :p …… anyways here it goes. The commented out lines should not be commented out. I did that while doing some testing. I forgot why I did that.
param (
[string]$emlto,
[string]$sub,
[string]$msg,
[string]$attch
)
$smtp=new-object Net.Mail.SmtpClient("<mail-gateway>",25)
$emailFrom = new-object Net.Mail.MailAddress("email@address.com")
$emailTO = new-object Net.Mail.MailAddress("email@address.com ")
$mlmsg = new-object Net.Mail.MailMessage($emailFrom,$emailTO)
$mlmsg.Subject=$sub
$mlmsg.Body=$attch
#$data = new-object Net.Mail.Attachment("F:\Catalog\EURAZA-NBKP201_CATALOG_DR_FILE\$attch")
#$mlmsg.Attachments.Add($data)
$smtp.Send($mlmsg)