Python - Sending Arabic E-Mails using smtplib
<p>I'm trying to send and email including Arabic and Persian characters, using smtplib. The Following is my Function:</p>

<pre><code>def send_email (admin, pwd, user, message):
    server = smtplib.SMTP('smtp.gmail.com', 587)
    server.ehlo()
    server.starttls()
    server.login(admin, pwd)
    server.sendmail(admin, user, message)
    server.close()
    return True

send_email('sender@example.com', 'example', 'reciever@example.com', 'Ú©Ø§Ø±Ø§Ú©ØªØ± ÙØ§Ø±Ø³Û Ù Ø¹Ø±Ø¨Û Persian and Arabic Characters')
</code></pre>

<p>and, I get the following error:</p>

<pre><code>msg = _fix_eols(msg).encode('ascii')
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
</code></pre>

<p>Any ideas on how to fix it?</p>

<p>try .encode('UTF-8') 
hope it'll help</p>

python email smtplib