Skip to content

Commit

Permalink
Merge pull request #1142 from emanueldima/mail-config
Browse files Browse the repository at this point in the history
Simplified mail sending; config default to not sending
  • Loading branch information
emanueldima committed Sep 30, 2016
2 parents 0754009 + 0c86f9d commit 0109d34
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
1 change: 1 addition & 0 deletions b2share/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@


SUPPORT_EMAIL = None # must be setup in the local instances
MAIL_SUPPRESS_SEND = True # this should be removed on a real instance


# Default language and timezone
Expand Down
12 changes: 2 additions & 10 deletions b2share/modules/records/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,11 +352,7 @@ def post(self, **kwargs):
sender=str(request.json['email']),
recipients=[support],
body=msg_content)
app = Flask('abuseapp')
app.config.update(MAIL_SUPPRESS_SEND=True)
InvenioMail(app)
with app.app_context():
app.extensions['mail'].send(msg)
current_app.extensions['mail'].send(msg)
return jsonify({'message':'The record is reported.'})


Expand Down Expand Up @@ -388,9 +384,5 @@ def post(self, **kwargs):
sender=str(request.json['email']),
recipients=[support],
body=msg_content)
app = Flask('accessapp')
app.config.update(MAIL_SUPPRESS_SEND=True)
InvenioMail(app)
with app.app_context():
app.extensions['mail'].send(msg)
current_app.extensions['mail'].send(msg)
return jsonify({'message': 'An email was sent to the record owner.'})

0 comments on commit 0109d34

Please sign in to comment.