Mail in separate application

29 views
Skip to first unread message

Annet

unread,
Feb 19, 2020, 12:19:05 PM2/19/20
to web2py-users
I have three applications all of which have mail functionality. Since this
gives a lot of dupliacte code I thought of moving all mail functionality
to its own mail application.

I have one masterapp controlpanel with the following code;

if not request.env.remote_addr in ['127.0.0.1', 'localhost']:
    response.cookies[response.session_id_name]['domain'] = ".mydomain.org"


to which the other apps connect:

session.connect(request, response, masterapp="controlpanel")


the other apps already use the following code to check if a user is logged in:

if 'auth' in globals() and auth.is_logged_in():


At the moment all apps have the following setting:

mail = auth.settings.mailer


Is it possible to only have this code in the controlpanel application and have
the other apps check;

if 'mail' in globals():

and then use 'mail' to send mail?


Kind regards,

Annet
Reply all
Reply to author
Forward
0 new messages