This worked great for me. Just wanted to add a couple notes in case anyone 
else is interested-

I made ses_mailer a class with a call to send for compatibility with w2p's 
built-in mail capabilities. 

So, something like-

class ses_mailer(object):
  def send(self, to='', ....)

And then in the model-

auth.settings.mailer = ses_mailer()


Thanks again for the help, Anthony.
-j


On Tuesday, December 12, 2017 at 11:32:07 AM UTC-7, Jordan Ladora wrote:
>
> Cool! Thanks Anthony, I will try that.
>
>
>
> On Tue, Dec 12, 2017 at 11:02 AM, Anthony <abasta...@gmail.com> wrote:
>
>> No, but you can pass a custom mailer to the Auth system to get it to send 
>> emails via AWS SES. You custom mailer should take the same arguments as the 
>> web2py mail.send() method (in particular, Auth just needs the "to", 
>> "subject", and "message" arguments) -- so, something like:
>>
>> def ses_mailer(to, subject, message):
>>     # Use "to", "subject", and "message" in the below call to the boto 
>> send() 
>> method.
>>     boto3.client('ses', ...).send(...)
>>
>> Then either:
>>
>> auth = Auth(..., mailer=ses_mailer)
>>
>> or after defining auth:
>>
>> auth.settings.mailer = ses_mailer
>>
>> Anthony
>>
>>
>> On Tuesday, December 12, 2017 at 11:40:06 AM UTC-5, Jordan Ladora wrote:
>>>
>>> Hi,
>>>
>>> How can I have the w2p default mailer use a commercial service, in my 
>>> case, AWS SES via boto?
>>>
>>> I've got these lines in a model and would like to have w2p send 
>>> verification & reset password emails via boto-
>>>
>>> *mail = auth.settings.mailer*
>>> *mail.settings.server = ...*
>>> *mail.settings.server = ...*
>>> *mail.settings.sender = ...*
>>> *mail.settings.login = ...*
>>> *auth.settings.registration_requires_verification = True*
>>> *auth.settings.registration_requires_approval = True*
>>> *auth.messages.verify_email = 'Click on the link http://' + 
>>> request.env.http_host + URL(r=request, c='default', f='user', 
>>> args=['verify_email']) + '/%(key)s to verify your email'*
>>> *auth.settings.reset_password_requires_verification = True*
>>> *auth.messages.reset_password = 'Click on the link http://' + 
>>> request.env.http_host + URL(r=request, c='default', f='user', 
>>> args=['reset_password']) + '/%(key)s to reset your password'*
>>>
>>>
>>> Thanks!
>>> -j
>>>
>>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/i13e9RJOxY0/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to