title: How do I send email from an Azure function app?
body: <p>I have running Azure function App(in python language), for business requirements need to send emails from function app.</p>
  <p>for that, I wrote a python function</p>
  <pre><code>from email.message import EmailMessage
  import smtplib
  
  def send_mail():
      # message to be sent
      msg = EmailMessage()
      msg.set_content('Test content')
  
      msg['Subject'] = 'Test'
      msg['From'] = &quot;test@hotmail.com&quot;
      msg['To'] = [&quot;test@hotmail.com&quot;]
  
      # creates SMTP session 
      s = smtplib.SMTP('smtp-mail.outlook.com', 587) 
      s.ehlo()
  
      # start TLS for security 
      s.starttls() 
      # Authentication 
      s.login(&quot;test@hotmail.com&quot;, &quot;password-to-login&quot;) 
        
      # sending the mail 
      s.send_message(msg)
      
      # terminating the session 
      s.quit() 
  
      return
  </code></pre>
  <p>Above block of code working fine in local machine. if I move the same code to Azure Function App it's not working.</p>
  <p>How do I make it work on the Azure function app?</p>
  <p>How do I send email from <strong>Gmail</strong> in Azure Function App?</p>