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 Roberts <tchend...@gmail.com> 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 <johosaph...@gmail.com> wrote:
> > from django.core.mail import EmailMessage
> >
> > On Wed, Jun 8, 2011 at 7:35 PM, Bobby Roberts <tchend...@gmail.com>
> 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...@xxxx.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.

Reply via email to