You are not logged in.
baxter wrote:
As you may recall, I was having trouble getting Django to send its email error messages. I knew that you can't use Django's default localhost email server, but still couldn't make it work. With a little help from Jeff Croft, I've figured it out, and thought I'd pass it on.
In the Django settings file, the relevant settings are:
EMAIL_HOST='mailN.webfaction.com'
EMAIL_HOST_USER='baxter'
EMAIL_HOST_PASSWORD='xxxxxx'
EMAIL_PORT='25'
DEFAULT_FROM_EMAIL = "admin@domain.com"
SERVER_EMAIL = "admin@domain.com"
Out of those, you probably DON'T need EMAIL_PORT, since Django defaults to 25 anyway. But the real key is DEFAULT_FROM_EMAIL or (more likely) SERVER_EMAIL. Once those were in place, it worked. It looks like the mail server won't send it through without a sender.
Thanks for the tip.
Remi.
Offline
Hey I have tried to do that but it still gives me the same error. I am not trying to get django error emails, but rather I want to send an email using the django send_mail function.
SMTPAuthenticationError at /getinfo/
(535, '5.7.0 authentication failed')
these are my settings:
EMAIL_HOST = 'mail3.webfaction.com'
EMAIL_HOST_USER = 'swanznito'
EMAIL_HOST_PASSWORD = '******'
EMAIL_PORT = '25'
DEFAULT_FROM_EMAIL = "swanznito@mydomain.com"
SERVER_EMAIL = "swanznito@mydomain.com"
is there a particular mailbox that the DEFAULT_FROM_EMAIL and SERVER_EMAIL have to be?
any other ideas?
Offline
I have EMAIL_PORT = 25 (integer, not a string) in my settings. Not sure if that's the problem.
Offline
fogleman wrote:
I have EMAIL_PORT = 25 (integer, not a string) in my settings. Not sure if that's the problem.
thanks for the quick reply but yea that still didn't work.
Offline
Assuming your control panel and forum usernames are the same this is your problem:
EMAIL_HOST = 'mail3.webfaction.com'
You're on Mail 4. ![]()
Offline
haha! it worked. thanks iaihmb. youre a lifesaver
Offline
I am having no luck with this - trying to send the Django broken_link emails.
Settings.py:
EMAIL_HOST = 'mail4.webfaction.com'
EMAIL_HOST_USER= 'dkiesow'
EMAIL_FROM = "damon@kiesow.net"
EMAIL_HOST_PASSWORD= '******'
EMAIL_PORT= '25'
SEND_BROKEN_LINK_EMAILS = True
DEFAULT_FROM_EMAIL = "damon@kiesow.net"
SERVER_MAIL= "damon@kiesow.net"
Any suggestions?
Offline
dkiesow wrote:
I am having no luck with this - trying to send the Django broken_link emails.
Settings.py:
EMAIL_HOST = 'mail4.webfaction.com'
EMAIL_HOST_USER= 'dkiesow'
EMAIL_FROM = "damon@kiesow.net"
EMAIL_HOST_PASSWORD= '******'
EMAIL_PORT= '25'
SEND_BROKEN_LINK_EMAILS = True
DEFAULT_FROM_EMAIL = "damon@kiesow.net"
SERVER_MAIL= "damon@kiesow.net"
Any suggestions?
Assuming your password is correct then your settings look OK... Do you get any useful error message in your logs?
Remi.
Offline
Nope - nothing showing in any error logs.
Offline
I have always found this a little annoying, almost everything that is installed in webfaction needs to be magled to use the external mail server. why can't you guys enable the local sendmail for apps to send out notifications? I have seen this happen with trac, wordpress and drupal.
Offline
dkiesow wrote:
Nope - nothing showing in any error logs.
Can you try your settings in a "manual" script (such as the one at http://blog.webfaction.com/email-faq#send ) and see if they work?
Remi.
Offline
mae wrote:
I have always found this a little annoying, almost everything that is installed in webfaction needs to be magled to use the external mail server. why can't you guys enable the local sendmail for apps to send out notifications? I have seen this happen with trac, wordpress and drupal.
There a few reasons for doing it that way:
- performance: we feel like e-mail traffic shouldn't impact websites
- monitoring: people can do a lot of bad things with an SMTP server so we want to monitor what's happening (make sure nobody is sending spam for instance). Having only a few dedicated SMTP servers makes this a lot easier
It's true that a few tools don't support external SMTP servers with authentication our of the box but this is becoming less and less frequent because most new tools or new versions of existing tools do support it.
Cheers,
Remi.
Offline
Yes - the test script works- but still no luck from with Django.
Offline
I believe that that this is your problem:
SEND_BROKEN_LINK_EMAILS = 'True'
SEND_BROKEN_LINK_EMAILS needs to be set to True, not 'True'.
Django can send e-mail, see:
[dkiesow@web23 banjo]$ python2.5 manage.py shell
Python 2.5.1 (r251, Nov 9 2007, 22:28:58)
[GCC 4.1.1 20070105 (Red Hat 4.1.1-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.core.mail import send_mail
>>> send_mail('Test', 'Test', 'damon@kiesow.net', ['david@webfaction.com'])
1
>>>
[dkiesow@web23 banjo]$
Hope it helps. ![]()
Offline
Thanks for catching those quotes. I had gone over that specific issue several times - but missed that one apparently.
But, still no luck on the email. I must have something else wrong in the code - it is obviously not Django or your email server that is the problem.
thanks
Damon
Offline
Actually - I am now getting an error in the logs:
SMTPSenderRefused: (553, '5.5.4 <root@localhost>... Real domain name required for sender address', 'root@localhost'), referer:
Will try to track this down, but not sure why it is not recognizing the settings.py directives.
Offline
Found the problem -
Along with the ' around True I also had SERVER_EMAIL typed as SERVER_MAIL
So - working now.
thanks
Damon
Last edited by dkiesow (2007-12-31 22:30:22)
Offline
IAIHMB wrote:
[dkiesow@web23 banjo]$ python2.5 manage.py shell
Python 2.5.1 (r251, Nov 9 2007, 22:28:58)
[GCC 4.1.1 20070105 (Red Hat 4.1.1-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.core.mail import send_mail
>>> send_mail('Test', 'Test', 'damon@kiesow.net', ['david@webfaction.com'])
1
>>>
[dkiesow@web23 banjo]$
Hi, I've been running into some email issues and ran across this thread. When I try the exact same thing you're doing above, I get an error at the point where I try to import send_mail:
[knoxvoice@web31 knoxvoice]$ python2.5 manage.py shell
Python 2.5.1 (r251, Feb 27 2008, 16:29:04)
[GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.core.mail import send_mail
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/knoxvoice/lib/python2.5/django/core/mail.py", line 4, in <module>
from email.MIMEText import MIMEText
File "/home/knoxvoice/webapps/django/knoxvoice/email.py", line 3, in <module>
import smtplib
File "/usr/local/lib/python2.5/smtplib.py", line 46, in <module>
import email.Utils
ImportError: No module named Utils
>>>
Any idea what might be happening? This is a brand new account.
- Jason
Offline
I believe that the problem is that ~/webapps/django/knoxvoice/ is on your PYTHONPATH and ~/webapps/django/knoxvoice/email.py has taken precedence over the e-mail module in Python's standard library. In other words, try renaming your e-mail.py. ![]()
Offline
That did the trick. Thanks!
Offline
I am using the GMAIL SMTP server for this purpose and it works... If you need help configuring with Gmail I can help...
Offline
I'm unable to get error emails using the following:
EMAIL_HOST = 'mail5.webfaction.com'
EMAIL_HOST_USER = 'pbeeson'
EMAIL_HOST_PASSWORD = '********'
DEFAULT_FROM_EMAIL = 'noreply@knoxd.com'
SEND_BROKEN_LINK_EMAILS = True
SERVER_EMAIL = 'patrick@knoxd.com'
EMAIL_PORT = 25
I can however receive emails sent using my site's contact form to the admins listed in the settings.py (using smtp). Any help would be appreciated!
Offline
Hey patrick, did u try sending mail using the commandprompt.
>>> from django.core.mail import send_mail
>>> send_mail('Test', 'Test', 'damon@kiesow.net', ['david@webfaction.com'])
1
You may find some useful error information if you do that.
Last edited by stranger1 (2008-05-27 17:46:02)
Offline
I did, and I get the following traceback:
>>> from django.core.mail import send_mail
>>> send_mail('Test', 'Test', 'patrick@knoxd.com', ['patrick@patrickbeeson.com'])
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/pbeeson/webapps/django/lib/django/core/mail.py", line 333, in send_mail
connection=connection).send()
File "/home/pbeeson/webapps/django/lib/django/core/mail.py", line 259, in send
return self.get_connection(fail_silently).send_messages([self])
File "/home/pbeeson/webapps/django/lib/django/core/mail.py", line 162, in send_messages
new_conn_created = self.open()
File "/home/pbeeson/webapps/django/lib/django/core/mail.py", line 127, in open
local_hostname=DNS_NAME.get_fqdn())
File "/usr/local/lib/python2.5/smtplib.py", line 244, in __init__
(code, msg) = self.connect(host, port)
File "/usr/local/lib/python2.5/smtplib.py", line 310, in connect
raise socket.error, msg
error: (111, 'Connection refused')
Also, when I use "mail5.webfaction.com" instead of "smtp5.webfaction.com" I can't use my site's contact form.
Offline
The SMTP servers require authentication. Here is the function signature of send_mail:
send_mail(subject, message, from_email, recipient_list,
fail_silently=False, auth_user=None,
auth_password=None)
... Try specifying auth_user and auth_password.
Regards,
~Chris Sebastian
Offline