Re: send_mail issue
got it... worked like a charm. i read that but it didn't click the first time. thanks again! On Jun 8, 9:50 pm, David Graveswrote: > Fromhttps://docs.djangoproject.com/en/dev/topics/email/#django.core.mail > like attachments argument should be a list of tuples, so instead of > attachments=(filename,filecontent,'application/vnd.ms-excel'), try > attachments=[(filename,filecontent,'application/vnd.ms-excel')]. If that > doesn't work, just take the attachments argument out, and do: > message.attach(filename,filecontent,'application/vnd.ms-excel') before your > message.send > > On Wed, Jun 8, 2011 at 7:59 PM, Bobby Roberts wrote: > > hey david... that got past he original error but now i'm getting this: > > > _create_attachment() takes at most 4 arguments (37 given) > > > i think this is happening from the content argument maybe? any idea > > how to get around that? > > > On Jun 8, 8:38 pm, David Graves wrote: > > > from django.core.mail import EmailMessage > > > > On Wed, Jun 8, 2011 at 7:35 PM, Bobby Roberts > > wrote: > > > > hi all... i'm trying to send an email attachment and am getting the > > > > following traceback: > > > > > global name 'EmailMessage' is not defined > > > > > Here's the code: > > > > > [...] > > > > from django.core.mail import send_mail > > > > > list2send = mymodel.objects.filter(idNumber = 3) > > > > filecontent = render_to_string('template_excel.html', > > > > {'trs':list2send}) > > > > filename = 'myfile.xls' > > > > > emailmsg = "See Attached" > > > > to_email="x...@.com" > > > > subject = "important email subject here" > > > > message = EmailMessage(subject, emailmsg, > > > > 'fromem...@domainname.com > > > > ',to_email,attchements=(filename,filecontent,'application/ > > > > vnd.ms-excel')) > > > > > message.send() > > > > > am i not importing something? > > > > > -- > > > > You received this message because you are subscribed to the Google > > Groups > > > > "Django users" group. > > > > To post to this group, send email to django-users@googlegroups.com. > > > > To unsubscribe from this group, send email to > > > > django-users+unsubscr...@googlegroups.com. > > > > For more options, visit this group at > > > >http://groups.google.com/group/django-users?hl=en. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To post to this group, send email to django-users@googlegroups.com. > > To unsubscribe from this group, send email to > > django-users+unsubscr...@googlegroups.com. > > For more options, visit this group at > >http://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: send_mail issue
From https://docs.djangoproject.com/en/dev/topics/email/#django.core.mail.EmailMessagelooks like attachments argument should be a list of tuples, so instead of attachments=(filename,filecontent,'application/vnd.ms-excel'), try attachments=[(filename,filecontent,'application/vnd.ms-excel')]. If that doesn't work, just take the attachments argument out, and do: message.attach(filename,filecontent,'application/vnd.ms-excel') before your message.send On Wed, Jun 8, 2011 at 7:59 PM, Bobby Robertswrote: > hey david... that got past he original error but now i'm getting this: > > _create_attachment() takes at most 4 arguments (37 given) > > i think this is happening from the content argument maybe? any idea > how to get around that? > > > > On Jun 8, 8:38 pm, David Graves wrote: > > from django.core.mail import EmailMessage > > > > On Wed, Jun 8, 2011 at 7:35 PM, Bobby Roberts > wrote: > > > hi all... i'm trying to send an email attachment and am getting the > > > following traceback: > > > > > global name 'EmailMessage' is not defined > > > > > Here's the code: > > > > > [...] > > >from django.core.mail import send_mail > > > > >list2send = mymodel.objects.filter(idNumber = 3) > > >filecontent = render_to_string('template_excel.html', > > > {'trs':list2send}) > > >filename = 'myfile.xls' > > > > >emailmsg = "See Attached" > > >to_email="x...@.com" > > >subject = "important email subject here" > > >message = EmailMessage(subject, emailmsg, > > > 'fromem...@domainname.com > > > ',to_email,attchements=(filename,filecontent,'application/ > > > vnd.ms-excel')) > > > > >message.send() > > > > > am i not importing something? > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "Django users" group. > > > To post to this group, send email to django-users@googlegroups.com. > > > To unsubscribe from this group, send email to > > > django-users+unsubscr...@googlegroups.com. > > > For more options, visit this group at > > >http://groups.google.com/group/django-users?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: send_mail issue
hey david... that got past he original error but now i'm getting this: _create_attachment() takes at most 4 arguments (37 given) i think this is happening from the content argument maybe? any idea how to get around that? On Jun 8, 8:38 pm, David Graveswrote: > from django.core.mail import EmailMessage > > On Wed, Jun 8, 2011 at 7:35 PM, Bobby Roberts wrote: > > hi all... i'm trying to send an email attachment and am getting the > > following traceback: > > > global name 'EmailMessage' is not defined > > > Here's the code: > > > [...] > > from django.core.mail import send_mail > > > list2send = mymodel.objects.filter(idNumber = 3) > > filecontent = render_to_string('template_excel.html', > > {'trs':list2send}) > > filename = 'myfile.xls' > > > emailmsg = "See Attached" > > to_email="x...@.com" > > subject = "important email subject here" > > message = EmailMessage(subject, emailmsg, > > 'fromem...@domainname.com > > ',to_email,attchements=(filename,filecontent,'application/ > > vnd.ms-excel')) > > > message.send() > > > am i not importing something? > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To post to this group, send email to django-users@googlegroups.com. > > To unsubscribe from this group, send email to > > django-users+unsubscr...@googlegroups.com. > > For more options, visit this group at > >http://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: send_mail issue
from django.core.mail import EmailMessage On Wed, Jun 8, 2011 at 7:35 PM, Bobby Robertswrote: > hi all... i'm trying to send an email attachment and am getting the > following traceback: > > global name 'EmailMessage' is not defined > > Here's the code: > > [...] >from django.core.mail import send_mail > >list2send = mymodel.objects.filter(idNumber = 3) >filecontent = render_to_string('template_excel.html', > {'trs':list2send}) >filename = 'myfile.xls' > >emailmsg = "See Attached" >to_email="x...@.com" >subject = "important email subject here" >message = EmailMessage(subject, emailmsg, > 'fromem...@domainname.com > ',to_email,attchements=(filename,filecontent,'application/ > vnd.ms-excel')) > >message.send() > > > am i not importing something? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: send_mail issue
On Wed, 2011-06-08 at 17:35 -0700, Bobby Roberts wrote: > global name 'EmailMessage' is not defined where does 'EmailMessage' come from? -- regards KG http://lawgon.livejournal.com Coimbatore LUG rox http://ilugcbe.techstud.org/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: send_mail issue
that should be message = EmailMessage(subject, emailmsg,'fromem...@domainname.com',to_email,attachments=(filename,filecontent,'application/ vnd.ms-excel')) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
send_mail issue
hi all... i'm trying to send an email attachment and am getting the following traceback: global name 'EmailMessage' is not defined Here's the code: [...] from django.core.mail import send_mail list2send = mymodel.objects.filter(idNumber = 3) filecontent = render_to_string('template_excel.html', {'trs':list2send}) filename = 'myfile.xls' emailmsg = "See Attached" to_email="x...@.com" subject = "important email subject here" message = EmailMessage(subject, emailmsg, 'fromem...@domainname.com',to_email,attchements=(filename,filecontent,'application/ vnd.ms-excel')) message.send() am i not importing something? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Django send_mail issue
Hi, I have never used sendmail in Ubuntu and I am not too good at networks. I was trying to implement a mail application in Django where I send a mail to the newly registered user for confirmation. I used the following settings in my settings.py file : EMAIL_HOST='localhost' #EMAIL_HOST_USER='vikesh' #EMAIL_HOST_PASSWORD='vikesh' EMAIL_PORT=1025 DEFAULT_FROM_EMAIL = "nore...@edciitr.com" SERVER_EMAIL = "ad...@domain.com" EMAIL_USE_TLS = False I am sending the mail like this - send_mail('Subject_Test','Content_Test','khanna.vik...@gmail.com', ['khanna.vik...@gmail.com']) Using these settings I am able to see the output on the console when I run the Python debugserver on port 1025 but when I change the port to 25, I am not able to send the mail using the same settings. My port 25 is open (which I confirmed by running sendmail and using netstat -an | grep "LISTEN"). I am a beginner, don't know if it is even possible to send a mail like this. Help will be appreciated. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
send_mail issue
Hi, I have never used sendmail in Ubuntu and I am not too good at networks. I was trying to implement a mail application in Django where I send a mail to the newly registered user for confirmation. I used the following settings in my settings.py file : * *EMAIL_HOST='localhost' #EMAIL_HOST_USER='vikesh' #EMAIL_HOST_PASSWORD='vikesh' EMAIL_PORT=1025 DEFAULT_FROM_EMAIL = "nore...@edciitr.com" SERVER_EMAIL = "ad...@domain.com" EMAIL_USE_TLS = False I am sending the mail like this - send_mail('Subject_Test','Content_Test',' khanna.vik...@gmail.com',['khanna.vik...@gmail.com']) Using these settings I am able to see the output on the console when I run the Python debugserver on port 1025 but when I change the port to 25, I am not able to send the mail using the same settings. My port 25 is open (which I confirmed by running sendmail and using netstat -an | grep "LISTEN"). I am a beginner, don't know if it is even possible to send a mail like this. Help will be appreciated. Regards, Vikesh Khanna, B.Tech. Computer Science, IV Year Indian Institute of Technology, Roorkee -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.