I keep getting a "no sender" error when trying to send email via Catalyst::View::Email::Template. I'm pretty sure it's some sort of config error, but I have tried everything I can think of with no resolution. Please take a gander at my config and code and tell me what you think I should do. Thanks!
Here's the code that sends the email:
my $to = $user->email;
$c->stash->{email_out} = {
to => $to,
subject => "XXX.com Membership Activation ($enc_string)",
template => 'activation.tt',
};
$c->forward($c->view('Email::Template'));
if (not scalar @{$c->error}) {
$c->log->debug("*** Email sent! $to ($enc_string) ***");
}
From MyApp.pm (not its real name, but the equivalent):
__PACKAGE__->config->{'View::Email::Template'} = {
template_prefix => 'emails',
stash_key => 'email_out',
default => {
view => 'TT',
content_type => 'text/plain',
charset => 'utf-8',
},
sender => {
mailer => 'SMTP',
mailer_args => {
host => 'mail.<mydomain>.com',
sasl_username => '<email address here>',
sasl_password => '<email password here>',
ssl => 1,
}
},
};
I have no config for View::Email because I don't plan on sending any non-templated emails. I've tried it with and without, no change. I also have no config directly in either my View::Email or View::Email::Template modules. I tried putting some in there but it didn't resolve the issue. Here's some of the debug output from Catalyst:
[debug] Path is "send_activation_email"
[debug] Arguments are "<username goes here>"
[debug] *** Manually sending activation email ***
[debug] *** Sending activation email ***
[debug] *** Found existing activation, 3 ***
[debug] C::V::Email::Template uses default view XXX::View::TT=HASH(0x1
+0238e1c0) for rendering.
[debug] C::V::Email uses default content_type text/plain.
[debug] Rendering template "emails/activation.tt"
[debug] C::V::Email uses specified content_type text/plain.
[error] no sender
I will post more debug output upon request, but there's nothing in there that appears useful, to my eyes.
Update: Solved! It appears that I was mis-interpreting the "no sender" error as being a config error. It was actually referring to the fact that I had not specified a "from" parameter. (I assumed it would use the "sender" values as a default.) Thanks to Oleg Kostyuk on the Catalyst mailing list for the fix!
It's all fine and dandy until someone has to look at the code.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.