Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Catalyst-View-Email CPAN distribution.

Report information
The Basics
Id: 64162
Status: resolved
Priority: 0/
Queue: Catalyst-View-Email

People
Owner: Nobody in particular
Requestors: ANSGAR [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

Attachments
0001-Add-support-for-setting-envelope-information.patch



Subject: Not possible to specify envelope information
Date: Wed, 22 Dec 2010 22:55:31 +0100
To: bug-Catalyst-View-Email [...] rt.cpan.org
From: Ansgar Burchardt <ANSGAR [...] cpan.org>
Download (untitled) / with headers
text/plain 626b
In Catalyst::View::Email::process, the mail is sent using this line: my $return = sendmail( $message, { transport => $self->_mailer_obj } ); This makes it impossible to specify envelope recipient and sender independent from the values used in the To, CC, From headers. To make this possible additional options have to be passed to the sendmail call: sendmail($email, { to => [ $to_1, $to_2 ], from => $sender }); (from Email::Sender::Manual::QuickStart) It would be nice if this would be possible. I'm using Catalyst::View::Email 0.27 from Debian, but the relevant part has not changed in 0.30. Regards, Ansgar
Download (untitled) / with headers
text/plain 865b
On Wed Dec 22 16:55:53 2010, ANSGAR wrote: Show quoted text
> In Catalyst::View::Email::process, the mail is sent using this line: > > my $return = sendmail( $message, { transport => $self->_mailer_obj } ); > > This makes it impossible to specify envelope recipient and sender > independent from the values used in the To, CC, From headers. To make > this possible additional options have to be passed to the sendmail call: > > sendmail($email, { to => [ $to_1, $to_2 ], from => $sender }); > (from Email::Sender::Manual::QuickStart) > > It would be nice if this would be possible. > > I'm using Catalyst::View::Email 0.27 from Debian, but the relevant part > has not changed in 0.30. > > Regards, > Ansgar
I'm not too sure what you mean. What are you trying to achieve that passing in header => [ ] or just $c->stash->{email}->{to} doesn't provide? Thanks, -J
Subject: Re: [rt.cpan.org #64162] Not possible to specify envelope information
Date: Wed, 22 Dec 2010 23:11:48 +0100
To: bug-Catalyst-View-Email [...] rt.cpan.org
From: Ansgar Burchardt <ANSGAR [...] cpan.org>
Download (untitled) / with headers
text/plain 2.3k
"J. Shirley via RT" writes: Show quoted text
> On Wed Dec 22 16:55:53 2010, ANSGAR wrote:
>> In Catalyst::View::Email::process, the mail is sent using this line: >> >> my $return = sendmail( $message, { transport => $self->_mailer_obj } ); >> >> This makes it impossible to specify envelope recipient and sender >> independent from the values used in the To, CC, From headers. To make >> this possible additional options have to be passed to the sendmail call: >> >> sendmail($email, { to => [ $to_1, $to_2 ], from => $sender }); >> (from Email::Sender::Manual::QuickStart)
> > I'm not too sure what you mean. What are you trying to achieve that passing in header => [ ] > or just $c->stash->{email}->{to} doesn't provide?
I want to use a From address in the envelope that in different from the From address used in the header. By default the envelope sender and recipients are generated from the "From", "To", "Cc", "Bcc" headers, but they can be specified manually as well (which is required to use different From addresses in the envelope and header). As far as I understand, $c->stash->{email}->{to} and header => [ ... ] only allow to set the values used in the headers, but not to set the envelope information to a different value. There is some more description in the Email::Sender::Manual::QuickStart documentation: --8<---------------cut here---------------start------------->8--- envelope information We didn't have to tell Email::Sender::Simple where to send the message. If you don't specify recipients, it will use all the email addresses it can find in the To and Cc headers by default. It will use Email::Address to parse those fields. Similarly, if no sender is specified, it will use the first address found in the From header. In most email transmission systems, though, the headers are not by necessity tied to the addresses used as the sender and recipients. For example, your message header might say "From: mailing-list@example.com" while your SMTP client says "MAIL FROM:<verp-1234@lists.example.com>". This is a powerful feature, and is necessary for many email application. Being able to set those distinctly is important, and Email::Sender::Simple lets you do this: sendmail($email, { to => [ $to_1, $to_2 ], from => $sender }); --8<---------------cut here---------------end--------------->8--- So I would like some way to pass these options to Email::Sender. Regards, Ansgar
Subject: Re: [rt.cpan.org #64162] AutoReply: Not possible to specify envelope information
Date: Sun, 02 Jan 2011 21:45:13 +0100
To: bug-Catalyst-View-Email [...] rt.cpan.org
From: Ansgar Burchardt <ANSGAR [...] cpan.org>
Download (untitled) / with headers
text/plain 613b
Show quoted text
> In Catalyst::View::Email::process, the mail is sent using this line: > > my $return = sendmail( $message, { transport => $self->_mailer_obj } ); > > This makes it impossible to specify envelope recipient and sender > independent from the values used in the To, CC, From headers. To make > this possible additional options have to be passed to the sendmail call: > > sendmail($email, { to => [ $to_1, $to_2 ], from => $sender }); > (from Email::Sender::Manual::QuickStart) > > It would be nice if this would be possible.
Here is a patch to implement this. Please consider applying it. Regards, Ansgar
From c8ad3621b679088e64caacb3ef5d4bdf5ca41e5b Mon Sep 17 00:00:00 2001 From: Ansgar Burchardt <ANSGAR@cpan.org> Date: Sun, 2 Jan 2011 21:29:15 +0100 Subject: [PATCH] Add support for setting envelope information. --- lib/Catalyst/View/Email.pm | 20 +++++++++++++++++++- 1 files changed, 19 insertions(+), 1 deletions(-) diff --git a/lib/Catalyst/View/Email.pm b/lib/Catalyst/View/Email.pm index db99dfc..e727cc8 100644 --- a/lib/Catalyst/View/Email.pm +++ b/lib/Catalyst/View/Email.pm @@ -162,6 +162,19 @@ contained ones. ], }; +You can set the envelope sender and recipient as well: + + $c->stash->{email} = { + + envelope_from => 'envelope-from@example.com', + from => 'header-from@example.com', + + envelope_to => [ 'foo@example.com', 'bar@example.com' ], + to => 'Undisclosed Recipients:;', + + ... + }; + =head1 HANDLING ERRORS If the email fails to send, the view will die (throw an exception). @@ -283,7 +296,12 @@ sub process { my $message = $self->generate_message( $c, \%mime ); if ($message) { - my $return = sendmail( $message, { transport => $self->_mailer_obj } ); + my $return = sendmail( $message, + { + exists $email->{envelope_from} ? ( from => $email->{envelope_from} ) : (), + exists $email->{envelope_to} ? ( to => $email->{envelope_to} ) : (), + transport => $self->_mailer_obj, + } ); # return is a Return::Value object, so this will stringify as the error # in the case of a failure. -- 1.7.2.3
Download (untitled) / with headers
text/plain 744b
On Sun Jan 02 15:45:25 2011, ANSGAR wrote: Show quoted text
> > In Catalyst::View::Email::process, the mail is sent using this line: > > > > my $return = sendmail( $message, { transport => $self->_mailer_obj } ); > > > > This makes it impossible to specify envelope recipient and sender > > independent from the values used in the To, CC, From headers. To make > > this possible additional options have to be passed to the sendmail call: > > > > sendmail($email, { to => [ $to_1, $to_2 ], from => $sender }); > > (from Email::Sender::Manual::QuickStart) > > > > It would be nice if this would be possible.
> > Here is a patch to implement this. Please consider applying it. > > Regards, > Ansgar >
This has been applied in 0.32. Release is pending.
Patch applied.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.