Skip to content

Commit

Permalink
Fixed diva email authentication for different user from the "FROM" fi…
Browse files Browse the repository at this point in the history
…eld.
  • Loading branch information
Fernando Oliveira committed Oct 14, 2014
1 parent d1abfee commit a75e12c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions addon-modules/Wifi/WebApp/Services.cs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ public bool SendEMailSync(string to, string subject, string message)
try
{
MailMessage msg = new MailMessage();
msg.From = new MailAddress(m_WebApp.SmtpUsername);
msg.From = new MailAddress(m_WebApp.SmtpFromEmail);
msg.To.Add(new MailAddress(to));
msg.Subject = "[" + m_WebApp.GridName + "] " + subject;
msg.Body = message;
Expand All @@ -371,7 +371,7 @@ public bool SendEMail(string to, string subject, string message)
try
{
MailMessage msg = new MailMessage();
msg.From = new MailAddress(m_WebApp.SmtpUsername);
msg.From = new MailAddress(m_WebApp.SmtpFromEmail);
msg.To.Add(new MailAddress(to));
msg.Subject = "[" + m_WebApp.GridName + "] " + subject;
msg.Body = message;
Expand Down
7 changes: 7 additions & 0 deletions addon-modules/Wifi/WebApp/WebApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,12 @@ public string SmtpUsername
get { return m_SmtpUsername; }
}

private string m_SmtpFromEmail;
public string SmtpFromEmail
{
get { return m_SmtpFromEmail; }
}

private string m_SmtpPassword;
public string SmtpPassword
{
Expand Down Expand Up @@ -298,6 +304,7 @@ public void ReadConfigs(IConfigSource config, string configName)
m_SmtpHost = appConfig.GetString("SmtpHost", "smtp.gmail.com");
m_SmtpPort = Int32.Parse(appConfig.GetString("SmtpPort", "587"));
m_SmtpUsername = appConfig.GetString("SmtpUsername", "your_email@gmail.com");
m_SmtpFromEmail = appConfig.GetString("SmtpFromEmail", m_SmtpUsername);
m_SmtpPassword = appConfig.GetString("SmtpPassword", "your_password");

m_AdminFirst = appConfig.GetString("AdminFirst", string.Empty);
Expand Down

0 comments on commit a75e12c

Please sign in to comment.