WebFaction
Community site: login faq

I tried to look for many options. The closest I got was using a Django command (I am open to any other option). With Django this is the command I use:

from django.core.management.base import NoArgsCommand from django.core.mail.message import EmailMessage

class Command(NoArgsCommand):

def handle_noargs(self, **options):
    email = EmailMessage('Subject', 'Body', 'noreply@mysite.com',['email@mysite.com']
    email.attach_file("~/encrypted-file.txt.gpg", "application/pgp-encrypted")
    email.send()

And I get: SyntaxError: invalid syntax (pointing email.attach_file) I tried using attach() but still no luck.

Thanks!

asked 27 Nov '12, 11:00

gabon
1548
accept rate: 0%


If that's your exact code, then you left the closing parenthesis off of the EmailMessage call.

permanent link

answered 27 Nov '12, 11:24

toddfiske
161
accept rate: 100%

Ok, the parenthesis to close the EmailMessage() is missing, embarrassing! :S

permanent link

answered 27 Nov '12, 11:23

gabon
1548
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×261
×6

question asked: 27 Nov '12, 11:00

question was seen: 5,650 times

last updated: 27 Nov '12, 11:24

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM