I just saw how the welcome app is.
The fact is (at least I think, there are a bit of turnarounds in the core code)...
mail = Mail()
is good if you later do
mail.send()
but Auth **needs** a mailer to send messages.
Auth(db) in reality "stands" for
Auth( db=None,
mailer=True,
hmac_key=......
)
the mailer parameter is treated as follows
mailer=(mailer == True) and Mail() or mailer
So............by default if you don't pass a mailer to Auth(), the default value (True) creates a Mail() object for you.
Current welcome is "smart" in exploiting such shortcuts
auth = Auth(db)
.....
mail = auth.settings.mailer
mail.settings.server = 'logging' or 'smtp.gmail.com:587'
mail.settings.sender = 'y...@gmail.com'
mail.settings.login = 'username:password'
This "assigns" to the mail variable the Mail() created by Auth (so that Auth can use it), and configures it accordingly
The "other" method would be to
mail=Mail()
mail.settings.server='smtp.gmail.com:587'
mail.settings.sender='y...@somewhere.com'
mail.settings.login='username:password'
auth=Auth(db)
auth.settings.mailer=mail
# auth.settings....=...
auth.define_tables()
In this way, Mail() created by Auth() is "overwritten" by your Mail() with the settings.
Same thing goes with
but in this case, Auth doesn't create it, so it's just an assignment and not an override ^__^