Page 1 of 1
Email Template hardcoded recipient not working?
Posted: March 8th, 2012, 3:46 am
by Ronner
I have the following template;
## polly template
<!--#if $cat == "tv" and $status #--><!--#slurp#-->
To:
girlfriends.email@domain.com
From: $from
Date: $date
Subject: SERIE - $name
X-priority: 5
X-MS-priority: 5
$name
is now available...
<!--#end if#-->
The template works, but the mail is not sent to "
girlfriends.email@domain.com" but to the emailaddress specified in the sabnzbd email configuration screen. I'm running 0.6.15.
Am I doing something wrong or is this a bug?
Re: Email Template hardcoded recipient not working?
Posted: March 8th, 2012, 6:15 am
by shypike
Did you also tell SABnzbd where to look for the new template?
Where did you store it?
Re: Email Template hardcoded recipient not working?
Posted: March 8th, 2012, 7:09 am
by Ronner
I have two templates;
email-polly.tmpl
email-ronner.tmpl
both are in /home/media/.sabnzbd/emailtemplates and this folder is also the folder that is set in the Sabnzbd configuration as the Email Templates Folder.
Like I said, the templates work, the emails are being sent, but they are simply always sent to the address that is in the Sabnzbd settings, instead of to the hardcoded address I specified in the template (in the above example "To:
girlfriends.email@domain.com")
Re: Email Template hardcoded recipient not working?
Posted: March 8th, 2012, 11:02 am
by shypike
I remember now a case from the past.
The "To" field from template isn't actually used because it would prohibit SABnzbd
from sending a conditional email to a range of recipients.
Conditional allows you to send a different email based on the name of the recipient.
In your case you would put rolly's and ronner's email addresses (separated by commas) in SABnzbd's UI.
Then make each email template conditional based on the recipient's email address.
Re: Email Template hardcoded recipient not working?
Posted: March 8th, 2012, 12:09 pm
by Ronner
I think I catch your drift on how to do this, but could you give an example on how I would check this in the template?
Re: Email Template hardcoded recipient not working?
Posted: March 8th, 2012, 1:11 pm
by shypike
Re: Email Template hardcoded recipient not working?
Posted: March 8th, 2012, 2:02 pm
by Ronner
[SarcasmMode]Oh you mean the wiki that states "If you want to use different email formats based on the email recipient, you should hard-code the recipient(s) in the template and not use the $to variable." And the same wiki that has an example template on conditional mails that doesn't work because for some strange reason it needs a ## comment on the first line for it to work.[/SarcasmMode]
That wiki? ;-)
Re: Email Template hardcoded recipient not working?
Posted: March 8th, 2012, 2:31 pm
by shypike
You mean the one that was just updated because it was no longer accurate?
Yes, that one!

Re: Email Template hardcoded recipient not working?
Posted: March 8th, 2012, 3:47 pm
by Ronner
That got updated after I posted my sarcasm ;-)
Thx for the help btw

Re: Email Template hardcoded recipient not working?
Posted: March 9th, 2012, 6:15 am
by shypike
Ronner wrote:That got updated after I posted my sarcasm ;-)
Of course it was, where would we be without community support?
Re: Email Template hardcoded recipient not working?
Posted: March 9th, 2012, 6:37 am
by Ronner
Very true, and with that spirit in mind, this is the way I did it now and this works;
#encoding utf-8
<!--#if $cat == "tv" and $status and $to == "
email@domain.com" #--><!--#slurp#-->
To: $to
From: $from
Date: $date
Subject: SERIE - $name
X-priority: 5
X-MS-priority: 5
$name
is now available...
<!--#end if#-->