Skip to content

Commit

Permalink
fix for unauthenticated mailing (fix #38)
Browse files Browse the repository at this point in the history
  • Loading branch information
ansibleguy committed May 13, 2024
1 parent 982fedb commit e4d8656
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/ansibleguy-webui/aw/execute/alert_plugin/plugin_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@


def _email_send(server: SMTP, user: USERS, stats: dict, execution: JobExecution, error_msgs: dict):
server.login(user=config['mail_user'], password=config['mail_pass'])
if is_set(config['mail_pass']):
server.login(user=config['mail_user'], password=config['mail_pass'])

msg = MIMEMultipart('alternative')
msg['Subject'] = f"Ansible WebUI - Job '{execution.job.name}' - {execution.status_name}"
msg['From'] = config['mail_sender']
msg['From'] = config['mail_sender'] if is_set(config['mail_sender']) else config['mail_user']
msg['To'] = user.email

tmpl_html, tmpl_text = 'email/alert.html', 'email/alert.txt'
if is_set(config['path_template']):
if is_set(config['path_template']): # custom templates
_tmpl_base = Path(config['path_template'])
_tmpl_html = _tmpl_base / 'alert.html'
_tmpl_text = _tmpl_base / 'alert.txt'
Expand Down

0 comments on commit e4d8656

Please sign in to comment.