diff --git a/server/app/api/routes.py b/server/app/api/routes.py index 1fe74b7..5664b0c 100644 --- a/server/app/api/routes.py +++ b/server/app/api/routes.py @@ -32,6 +32,10 @@ def send_rfq(): resp = jsonify(error="missing body") return make_response(resp, 400) + if "configuration" not in payload: + resp = jsonify(error="missing configuration") + return make_response(resp, 400) + recipient = current_app.config["MAIL_RECIPIENT"] msg = Message( @@ -39,10 +43,25 @@ def send_rfq(): reply_to=recipient, sender=payload["email"], recipients=[recipient]) - msg.body = payload["body"] msg.html = payload["body"] - mail.send(msg) + msg_client_confirmation = Message( + "[M-Labs - Order Hardware]", + reply_to=recipient, + sender=recipient, + recipients=[payload["email"]]) + msg_client_confirmation.body = "Hello! We've received your request and " \ + "will be in contact soon. " \ + "Here is a reminder of your configuration: {}" \ + "Thank you!".format(payload["configuration"]) + msg_client_confirmation.html = "Hello!
" \ + "We've received your request and will be in contact soon.
" \ + "Here is a reminder of your configuration: {}

" \ + "Thank you!".format(payload["configuration"]) + + with mail.connect() as conn: + conn.send(msg) + conn.send(msg_client_confirmation) return jsonify("ok") diff --git a/static/js/shop.jsx b/static/js/shop.jsx index 8d903db..f21d796 100644 --- a/static/js/shop.jsx +++ b/static/js/shop.jsx @@ -1860,6 +1860,7 @@ class Shop extends React.PureComponent { axios.post(data.API_RFQ, { email, body, + configuration: JSON.stringify(crate), headers: {'X-MLABS-OH': 'rlebcleu'} }).then(response => { this.setState({