#8292 how to configure external smtp server properties in development.ini for configuring mail

SMTP (1)

I am able to send mail using the sample python smtp configuration from my local machine using the below code

*sender = 'from@fromdomain.com'
receivers = ['to@todomain.com']

message = """From: From Person from@fromdomain.com
To: To Person to@todomain.com
Subject: SMTP e-mail test

This is a test e-mail message.

smtpObj = smtplib.SMTP('externalServerAddress:portNumber')
smtpObj.sendmail(sender, receivers, message)
print "Successfully sent email"
except SMTPException:
print "Error: unable to send email"*

W.r.to development.ini I tried configuring the below SMTP parameters

error_email_from = from@fromdomain.com

; SMTP settings for outgoing mail
smtp_tls = false
smtp_ssl = false

smtp_timeout = 10
smtp_server = externalServerAddress
smtp_port = portNumber
; Reply-To and From address often used in email notifications:
forgemail.return_path = from@fromdomain.com

forgemail.host = externalServerAddress
forgemail.port = portNumber
; domain suffix for your mail, change this. You also need to route ..*.forgemail.domain to the above host/port via
; your mail and DNS configuration
forgemail.domain = fromDomain.com

Even after configuring the above parameters, and starting the gunicorn, the mails are not sent from ui.
Am I missing any configuration in development.ini file.
Could someone assist in setting up the configuration to externalServerAddress in development.ini so that the email could be sent from tickets.


  • karthik - 2019-06-05

    Thanks for your quick assistance Dave.

    After your hint, we found that Email address is not configured for the profile and because of which email was not sent.

    We are using LDAP for user login and we presumed that email address would be fetched from LDAP and would be saved to the user profile automatically in allura.

    Using LDAP as user login and profile activation, it wouldnt be required for a user to enter his email address manually in the profile preference(atleast the primary email shall be the email address available as a part of ldap).

    Is there any configuration that needs to be done in order to automate the above process, to fetch the user email address based on ldap and save it as primary email address.

    Thank you.


    Last edit: karthik 2019-06-05
  • Dave Brondsema

    Dave Brondsema - 2019-06-05

    In the config file you should be able to set for example user_prefs_storage.ldap.fields.email_address = emailAddr if emailAddr is the name of the field in ldap, of course change it if it is something different.

    I think that should work, but we haven't tested all types of LDAP configurations so you may run into further issues. https://forge-allura.apache.org/p/allura/tickets/8266/ is an open issue about documenting fields like above, and when ldap is read-only.


Log in to post a comment.