Re: [Catalyst] Requesting example code for postfix and Email::Sender

2011-03-21 Thread will trillich
You're probably overthinking this. :)

Whether it's postfix or exim or any other daemon really shouldn't matter.
Your code will connect to SMTP server localhost on port 25. If you can
send an email from the command line (via 'mutt' or 'mail' etc) then you
should be ready to go:

First

$ *script/myapp_create.pl view Email Email*

Then

#myapp.conf
View::Email
stash_key= *email*
default
content_type = text/plain
charset  = utf-8
/default
/View::Email

Then in a controller...

$c-stash-{*email*} = {
from   = $c-config-{email_from},
'reply-to' = $c-user-email_name,
to = $c-user-email_name,
cc = join(',', @cc),
subject= $subj,
body   = $message,
};
$c-forward( $c-view('Email') );

Note on the manpage (below) that it will default to LOCALHOST and SMTP
unless you specify otherwise
http://search.cpan.org/~dhoss/Catalyst-View-Email-0.31/lib/Catalyst/View/Email.pm


On Mon, Mar 21, 2011 at 6:17 PM, Kutbuddin Doctor 
ksdoc...@sanfordburnham.org wrote:

 I am looking for an example of how to configure catalyst to use postfix on
 localhost to send email (mostly application notifications) via catalyst.

 And especially example code from someone who has done this successfully. I
 have seen several recommendations for using Email::Sender with catalyst but
 no examples of how to do this with postfix running locally. All of the
 Transport examples are either SMTP or sendmail. The rest of
 Email::Sender::Transport CPAN documentation is very sparse.

 Thanks for the help!

 cheers,
 Kutbuddin

 --






 ___
 List: Catalyst@lists.scsys.co.uk
 Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
 Searchable archive:
 http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
 Dev site: http://dev.catalyst.perl.org/




-- 
11 cheers for binary!
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Requesting example code for postfix and Email::Sender

2011-03-21 Thread Dave Rolsky

On Mon, 21 Mar 2011, Kutbuddin Doctor wrote:

I am looking for an example of how to configure catalyst to use postfix on 
localhost to send email (mostly application notifications) via catalyst.


And especially example code from someone who has done this successfully. I 
have seen several recommendations for using Email::Sender with catalyst but 
no examples of how to do this with postfix running locally. All of the 
Transport examples are either SMTP or sendmail. The rest of 
Email::Sender::Transport CPAN documentation is very sparse.


As Will pointed out in his email, you're overthinking this.

However, I think his suggestion that you connect to port 25 is a poor 
choice. The problem here is that this assumes that the server will always 
answer and be able to process the SMTP request.


That's a bad assumption. You could check the SMTP request status and 
retry, or you could make your life a lot easier, and use the sendmail 
binary. This isn't Sendmail specific since basically every mail server 
provides the same implementation of a binary called sendmail.


Usually, this will be implemented as something that just writes a file to 
the server's mail queue, without relying on the server actually running. 
The server will pick it up when it runs, and will handle it from there.


TL;DR - Use Email::Sender::Transport::Sendmail unless you have a really 
good reason to use something else.



-dave

/*
http://VegGuide.org   http://blog.urth.org
Your guide to all that's veg  House Absolute(ly Pointless)
*/

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Requesting example code for postfix and Email::Sender

2011-03-21 Thread Charlie Garrison

Good morning,

On 21/03/11 at 11:17 AM -0700, Kutbuddin Doctor 
ksdoc...@sanfordburnham.org wrote:



All of the Transport examples are either SMTP or sendmail.


Postfix is sendmail compatibile as far as injecting into the 
local mail queue. All distros I've seen for postfix will replace 
`sendmail` with a version that injects into postfix queue.


So that's why you haven't found any docco specific to using 
postfix; it's the same as using sendmail.



Charlie

--
   Ꮚ Charlie Garrison ♊ garri...@zeta.org.au

O ascii ribbon campaign - stop html mail - www.asciiribbon.org
〠  http://www.ietf.org/rfc/rfc1855.txt


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Requesting example code for postfix and Email::Sender

2011-03-21 Thread John M. Dlugosz
On 3/21/2011 1:37 PM, will trillich will.trillich-at-serensoft.com |Catalyst/Allow to 
home| wrote:

$c-stash-{*email*} = {
 from   =  $c-config-{email_from},
 'reply-to' =  $c-user-email_name,
 to =  $c-user-email_name,
 cc =  join(',', @cc),
 subject=  $subj,
 body   =  $message,
};
$c-forward( $c-view('Email') );



I didn't like that one (the mail view) because I don't follow: if your function sends 
email instead of generating a web page, what happens to the UA on the other end of the 
network who triggered that URL?


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Requesting example code for postfix and Email::Sender

2011-03-21 Thread Andrew Rodland
On Monday, March 21, 2011 08:56:55 PM John M. Dlugosz wrote:
 On 3/21/2011 1:37 PM, will trillich will.trillich-at-serensoft.com
 |Catalyst/Allow to
 
 home| wrote:
  $c-stash-{*email*} = {
  
   from   =  $c-config-{email_from},
   'reply-to' =  $c-user-email_name,
   to =  $c-user-email_name,
   cc =  join(',', @cc),
   subject=  $subj,
   body   =  $message,
  
  };
  $c-forward( $c-view('Email') );
 
 I didn't like that one (the mail view) because I don't follow: if your
 function sends email instead of generating a web page, what happens to the
 UA on the other end of the network who triggered that URL?

There doesn't need to be any instead of. The email view doesn't set any 
response body, so the default view will still run later on by whatever means 
usually runs it (i.e. RenderView).

Andrew

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Requesting example code for postfix and Email::Sender

2011-03-21 Thread John M. Dlugosz

On 3/21/2011 4:46 PM, Dave Rolsky autarch-at-urth.org |Catalyst/Allow to home| 
wrote:
Usually, this will be implemented as something that just writes a file to the server's 
mail queue, without relying on the server actually running. The server will pick it up 
when it runs, and will handle it from there.


TL;DR - Use Email::Sender::Transport::Sendmail unless you have a really good reason to 
use something else.


Ah, that's very good to know.

However, I don't seem to have a program called 'sendmail' on the path.
I had installed Postfix via the Debian package.

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Requesting example code for postfix and Email::Sender

2011-03-21 Thread John M. Dlugosz
On 3/21/2011 9:07 PM, Andrew Rodland andrew-at-cleverdomain.org |Catalyst/Allow to home| 
wrote:

There doesn't need to be any instead of. The email view doesn't set any
response body, so the default view will still run later on by whatever means
usually runs it (i.e. RenderView).



I thought forward was like a redirect, in that it stopped working here and went there 
instead.
The examples are misleading, as that is the last line in the body!  I see from the docs 
that forward is indeed a call


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Requesting example code for postfix and Email::Sender

2011-03-21 Thread Andrew Rodland
On Monday, March 21, 2011 09:12:52 PM John M. Dlugosz wrote:
 On 3/21/2011 4:46 PM, Dave Rolsky autarch-at-urth.org |Catalyst/Allow to 
home| wrote:
  Usually, this will be implemented as something that just writes a file to
  the server's mail queue, without relying on the server actually running.
  The server will pick it up when it runs, and will handle it from there.
  
  TL;DR - Use Email::Sender::Transport::Sendmail unless you have a really
  good reason to use something else.
 
 Ah, that's very good to know.
 
 However, I don't seem to have a program called 'sendmail' on the path.
 I had installed Postfix via the Debian package.

The postfix debian package installs sendmail as /usr/sbin/sendmail which isn't 
on the path for non-root users by default. Not sure why, exactly.

Andrew

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/