title: I am using Flask-mail but i am getting this error : smtplib.SMTPRecipientsRefused
body: <p>I am making this contact form using Flask mail but i am getting this Error:
  "smtplib.SMTPRecipientsRefused</p>
  
  <p>smtplib.SMTPRecipientsRefused: {'': (555, b'5.5.2 Syntax error. q18sm30917485pgv.9 - gsmtp' "</p>
  
  <p>for this Contact form i have app specific password, but still i am getting error. Please Help !!</p>
  
  <p>Here's the code:</p>
  
  <pre><code>import os
  from flask import Flask, render_template, url_for, redirect, request, flash
  from flask_mail import Mail, Message 
  from forms import ContactForm
  from flask_debugtoolbar import DebugToolbarExtension
  
  app = Flask(__name__)
  app.debug = True
  app.config['SECRET_KEY'] = 'thisissecrtet'
  toolbar = DebugToolbarExtension(app)
  app.config.update(
      #email settings
      MAIL_SERVER = 'smtp.gmail.com',
      MAIL_PORT = 465,
      MAIL_USE_SSL = True,
      MAIL_USERNAME = 'myusername',
      MAIL_PASSWORD = 'mypassword'
      )
  
  mail  = Mail(app)
  
  
  @app.route('/form', methods=['GET', 'POST'])
  
  def Contact():
      form = ContactForm()
      if request.method == 'POST':
          if form.validate() == False:
              flash('You must enter something in all that fields !')
              return render_template('contact.html', form=form)
          else:
              msg = Message(form.subject.data, sender='[SENDER EMAIL]', recipients=['[RECIPIENT EMAIL]'])
              msg.body =  """
              From: %s %s &lt;%s&gt;
              %s
              """% (form.firstName.data, form.lastName.data, form.email.data, form.message.data)
              mail.send(msg)
              return render_template('contact.html', success=True)
      elif request.method == 'GET':
              return render_template('contact.html', title='Contact Form', form=form)
      return render_template('contact.html', title='Flask Contact')
  
  
  
  @app.route('/name/&lt;string&gt;')
  def index(string):
      return '&lt;h1&gt;Contact Form Using Flask !'+string+'&lt;/h1&gt;'
  
  
  
  if __name__ == '__main__':
      app.run()
  </code></pre>