none
[Python][Web Apps] Django Server Not Connected - Can't Send Email RRS feed

  • Domanda

  • Hello!

    We have an Azure customer @TimpleSoft that asked questions over Twitter regarding difficulties sending email with a Django App. We would appreciate your assistance with this inquiry.

    "I can't send email with a Django app hosted in a Virtual Machine using webfaction server. The error is SMTPServerDisconnected (Server not connected), but it seems to be something between webfaction and Azure. I tried opening SMTP and SMTPS endpoints, changing configuration, but nothing works for me."

    Thank you again!

    @AzureSupport



    mercoledì 13 gennaio 2016 19:10

Tutte le risposte

  • Hello @TimpleSoft,

    I am a PM on the Azure App Service team.

    Could you go to the Kudu console (http://<site-name>.scm.azurewebsites.net/DebugConsole) and run the following command?

    tcpping SMTP.host.com

    If you could mask the output and share any error messages that arise it would help us debug the issue you are experiencing.

    Thanks,

    Cory

    mercoledì 13 gennaio 2016 23:09
  • Hello @cfowlerMSFT:

    I don't have a azurewebsites.net domain, my app is running in a virtual machine with a cloud service <site-name.cloudapp.net>. However, I can access via ssh and run whatever command that you want to test, please let me know.

    Thanks.
    BR.
    Julio Martínez.
    mercoledì 13 gennaio 2016 23:30
  • Hello again,

    Finally I could install tcpping in the server and run the command. I had no errors, all attempts are like this:

    seq 256: tcp response from unknown.prolexic.com (72.52.4.120) [open]  11.473 ms

    I hope that helps.

    Thanks,
    BR.
    Julio Martínez.
    mercoledì 13 gennaio 2016 23:59
  • My apologies, I thought that this had to do with App Service, not Cloud Services. Unfortunately, this is not my area of expertise. 

    I will attempt to track someone down who is better suited to help you with this issue.

    Thanks,

    Cory

    giovedì 14 gennaio 2016 00:05
  • Hello Julio,

    I am not too sure about the settings and the endpoints that you have set for SMTP. I also don't find the settings in either the forum post or the email.

    Here are the settings that you need to add in settings.py:

    1.Set recipients of error notifications. On a new line, set ADMINS to a tuple of tuples containing names and email addresses of notification recipients. For example, insert ADMINS = (('Jane', 'jane@example.com'), ('John', 'john@example.com')).
    2.Set the host name of the SMTP server. On a new line, add EMAIL_HOST = 'smtp.webfaction.com'.
    3.Set the SMTP user name. On a new line, add EMAIL_HOST_USER = 'mailbox', where mailbox is a valid mailbox name.
    4.Set the SMTP password. On a new line, add EMAIL_HOST_PASSWORD = 'password', where password is the mailbox’s password.
    5. Set the EMAIL_PORT = 25 Please note that this is the same port that you need to enable for the Azure Virtual Machine.
    6. Specify not to use TLS (Secure) when talking to the SMTP Server EMAIL_USE_TLS = False
    7.Set the From (origin) email address. On a new line, add SERVER_EMAIL = 'address', where address is the sending email address.
    8.Save and close settings.py.

    Thanks,
    Syed Irfan Hussain

    venerdì 15 gennaio 2016 09:54
  • hi Julio,

    Thanks for your patients.

    Firstly, I wants to confirm that you can call the mail webfaction service successfully on your local.

    Please try this code on your local dev environment via add a Django application into your webfaction application:

    from smtplib import SMTP
    email_addr='**@webfaction.com'
    from_addr = email_addr
    to_addrs = [email_addr]
    msg = 'will test Email'
    s = SMTP()
    s.connect('smtp.webfaction.com',25)
    s.login('**','**')#mailbox name and psw
    s.sendmail(from_addr, to_addrs, msg)

    Secondly, you may need enable the SMTP port on your VM.

    Any information, please let me know.

    Regards,

    Will


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    lunedì 18 gennaio 2016 07:08
    Moderatore