'Send a welcome mail to newly-registered users
- especially suitable for users from Facebook/Google who don\'t
verify their emails
@param user: the user dict, must contain "email", and can
contain "language" for translation of the message
@param password: optional password to include in a custom welcome_email'

def s3_send_welcome_email(self, user, password=None):

    messages = self.messages
    settings = current.deployment_settings
    if (not settings.get_mail_sender()):
        current.response.error = messages.unable_send_email
        return
    T = current.T
    language = user.get('language')
    if language:
        T.force(language)
    system_name = s3_str(settings.get_system_name())
    subject = s3_str((messages.welcome_email_subject % {'system_name': system_name}))
    message = s3_str((messages.welcome_email % {'system_name': system_name, 'url': settings.get_base_public_url(), 'profile': URL('default', 'user', args=['profile']), 'password': password}))
    T.force(current.session.s3.language)
    recipient = user['email']
    if settings.has_module('msg'):
        results = current.msg.send_email(recipient, subject=subject, message=message)
    else:
        results = current.mail.send(recipient, subject=subject, message=message)
    if (not results):
        current.response.error = messages.unable_send_email
