Email Template hardcoded recipient not working?

Get help with all aspects of SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
Ronner
Newbie
Newbie
Posts: 9
Joined: January 19th, 2011, 11:40 am

Email Template hardcoded recipient not working?

Post 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?
User avatar
shypike
Administrator
Administrator
Posts: 19773
Joined: January 18th, 2008, 12:49 pm

Re: Email Template hardcoded recipient not working?

Post by shypike »

Did you also tell SABnzbd where to look for the new template?
Where did you store it?
Ronner
Newbie
Newbie
Posts: 9
Joined: January 19th, 2011, 11:40 am

Re: Email Template hardcoded recipient not working?

Post 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")
User avatar
shypike
Administrator
Administrator
Posts: 19773
Joined: January 18th, 2008, 12:49 pm

Re: Email Template hardcoded recipient not working?

Post 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.
Ronner
Newbie
Newbie
Posts: 9
Joined: January 19th, 2011, 11:40 am

Re: Email Template hardcoded recipient not working?

Post 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?
User avatar
shypike
Administrator
Administrator
Posts: 19773
Joined: January 18th, 2008, 12:49 pm

Re: Email Template hardcoded recipient not working?

Post by shypike »

We have a Wiki with lots of info
http://wiki.sabnzbd.org/email-templates
Ronner
Newbie
Newbie
Posts: 9
Joined: January 19th, 2011, 11:40 am

Re: Email Template hardcoded recipient not working?

Post 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? ;-)
User avatar
shypike
Administrator
Administrator
Posts: 19773
Joined: January 18th, 2008, 12:49 pm

Re: Email Template hardcoded recipient not working?

Post by shypike »

You mean the one that was just updated because it was no longer accurate?
Yes, that one! ;D
Ronner
Newbie
Newbie
Posts: 9
Joined: January 19th, 2011, 11:40 am

Re: Email Template hardcoded recipient not working?

Post by Ronner »

That got updated after I posted my sarcasm ;-)

Thx for the help btw :)
User avatar
shypike
Administrator
Administrator
Posts: 19773
Joined: January 18th, 2008, 12:49 pm

Re: Email Template hardcoded recipient not working?

Post by shypike »

Ronner wrote:That got updated after I posted my sarcasm ;-)
Of course it was, where would we be without community support?
Ronner
Newbie
Newbie
Posts: 9
Joined: January 19th, 2011, 11:40 am

Re: Email Template hardcoded recipient not working?

Post 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#-->
Post Reply