I have a feedback form, where users can leave comments. These comments will be emailed to me and users' email address will appears as reply_to in the header, which means I can address these comments if I click the "reply" button in the GMAIL. However, it seems like the 'reply-to' header does not work. Every time I click 'reply', I am writing to myself. Any suggestions?
The basic function is defined as below:
HTML CODE
<!-- The contact form-->
<form method="POST" action=contactus_output.html>
<table align="center" cellpadding="15" cellspacing="15">
<tr><th colspan="2" align="left"><h1>Contact Form</h1></th></tr>
<tr><th>Name:</th><td><input type="text" name="nm.name" id="id.name" required="required" /></td></tr>
<tr><th>Email:</th><td><input type="email" name="nm.email" id="id.email" required="required" /></td></tr>
<tr><th>Subject:</th><td><select id="sub" name="nm.sub" required="required"/><option value="" selected="selected">Select one of the subjects</option><option value="1" >Suggestion</option><option value="Bug report" >Bug report</option><option value="Other" >Other</option></select></td></tr>
<tr><th>Message:</th></tr>
<tr><th></th><td><textarea id="msg" rows="10" cols="40" name="nm.msg" required="required"></textarea></td></tr>
<tr><td colspan="2"><input type="submit" value=" Let us know! "></td></tr>
</table>
</form>
Python CODE
#define the function
def sendanemail(name,subj, rply, msg):
message = mail.EmailMessage(sender="Support <myapp#gmail.com>")
message.subject = subj
message.to = "Ubertool Support <myapp#gmail.com>"
message.reply_to= rply
message.cc = rply
message.body = '''A message submitted by %s, %s \n''' %(name, rply)
message.body = message.body+msg
message.send()
def post(self):
form = cgi.FieldStorage()
name = form.getvalue('nm.name')
rply = form.getvalue('nm.email')
subj = form.getvalue('nm.sub')
msg = form.getvalue('nm.msg')
sendanemail(name,subj, rply, msg)
Email header
from: Support myapp#gmail.com via 2uix4h7xygsz66weerlq.apphosting.bounces.google.com
reply-to: abc#gmail.com
to: Support <myapp#gmail.com>
cc: abc#gmail.com
date: Thu, Sep 20, 2012 at 5:20 PM
subject: Other
mailed-by: 2uix4h7xygsz66weerlq.apphosting.bounces.google.com
The problem is I click 'reply', my GMAIL replies to 'myapp#gmail.com', not 'abc#gmail.com'
The following is a summary of the comments.
The problem seems to be related to Gmail, as the Reply-To header is actually sent, and is because the sender and receiver are the same.
A workaround is to have a different sender and receiver address, to achieve that the email address <app-id>#<app-id>.appspotmail.com can be used.
Related
I'm developing an app for production planning in a factory using appengine/jinja2 and am stuck with how to ask the user to confirm if the app should overwrite existing data or delete an entity in the NDB.
Maybe someone can suggest a course of action?
In product_edit.py I do the following (simplified):
RequestHandler
...
execute query and find given product
template_values = {
'prod_id': query.prod_id,
'prod_desc': query.prod_desc,
}
template = JINJA_ENVIRONMENT.get_template('/html/product_edit.html')
self.response.write(template.render(template_values))
The product_edit.html file looks like below (I'm using w3.css).
...
<form class="w3-container" action="/products-save" method="post">
<label class="w3-text-blue"><b>Product ID</b></label>
<input value="{{prod_id}}" name="prod_id_txt" size="15" class="w3-input w3-border">
<br>
<label class="w3-text-blue"><b>Product Description</b></label>
<input value="{{prod_desc}}" name="prod_(I'm using w3.css)desc_txt" size="50"
<input class="w3-btn w3-blue" type="submit" value="Save">
</form>
It populates two inputs with the product ID and description coming from the NDB and provides a "Save" button.
The save invokes the appropriate request handler to write to the NDB. So I can overwrite the existing NDB entity, no probs.
But how can I ask the user to confirm before overwriting (or deleting) existing data?
In the product-save request handler I can of course display a page asking the user to confirm, but in doing this I lose the data from the original POST.
One option would be to send the data to the new Jinja2 template via hidden fields, and upon user confirmation save the data from the hidden fields. However, this would not win a code beuty contest and is prone to coding errors. Is there anything more elegant I could do?
For the delete form I could do something with a pop-up to ask for confirmation, but I would like to use the same method as for the edit so that they are visually similar.
Thanks in advance!
There are many ways to accomplish this. The most straightforward way is to wire the form submit through a javascript function before submitting. Change:
<input class="w3-btn w3-blue" type="submit" value="Save">
to
<div id="saveWithConfirm">
<input class="w3-btn w3-blue" type="button" value="Save" onclick="confirmOverwrite('ask');" />
</div>
then:
function confirmOverwrite(confirm) {
confirmDiv = document.getElementById("saveWithConfirm");
if ( confirm == "confirmed" ) {
document.getElementById("ID-of-Form-Here").submit();
} else if ( confirm == "ask" ) {
//... if you need to check the database first, do an ajax call here...
confirmDiv.innerHTML = '<input class="w3-btn w3-blue" type="button" value="No" onclick="confirmOverwrite(\'no\');" /><input class="w3-btn w3-blue" type="button" value="Yes" onclick="confirmOverwrite(\'confirmed\');" /> ';
} else {
confirmDiv.innerHTML = '<input class="w3-btn w3-blue" type="button" value="Save" onclick="confirmOverwrite(\'ask\');" /> ';
}
}
This way, you never leave the form.
I am trying to integrate paypal as a payment option. As I have done it (which works) is not using any paypal snd but just the simple html form. Ive been looking at it for a while and perhaps my question is stupid, but I don't understand what the difference is to just using the html form or (at paypal developer provided sdk)? Could someone explain please?
Also, I am trying to write a backend route with nodes/express. I set up the notify url for paypal which - as I understand- will return to me an object containing data (what was paid, the users paypal id etc.).
so what I did was:
1. set up notify url which goes to the (angular state) /summary. - Im not sure if it perhaps should be the backend url and not the state.
2. then I have the fronted http call (as I also want to display a purchase summary to customer after he paid at paypal).
3. route in the backend to post to db.
I have been looking a lot a different documentation and tutorials but don't quite understand it and if anyone would have a few min explaining it to me, that would be amazing!! Thank you!
app.controller('summaryCtrl', function($scope, $http){
return $http.post('api/order/summary', {???})
.then(function(paypalObj){
$scope.paypalObj=payppalObj;
})
// here I am not sure what Im sending/how do I know what the object Im getting back from paypal named)
})
router.post('/summary', function(req, res, next){
console.log(req.body,res, 'paypal')
User.findById(req.user.id)
....
Order.create
...
})
html form:
<form method="POST" accept-charset="utf-8" action="https://www.sandbox.paypal.com/xxx/xxx" name="pp" id="pp">
<input type="hidden" name="cmd" value="_xclick" class="validate">
<input type="hidden" name="business" value="name#yahoo.com" required="required">
<input type="hidden" name="currency_code" value="USD" required="required">
<input type="hidden" name="quantity" value="{{quantity}}" required="required">
<input type="hidden" name="amount" value="{{price}}" required="required">
<input type="hidden" name="return" value="http://localhost:1337" required="required">
<input type="hidden" name="cancel_return" value="http://localhost:1337/about" required="required">
<input type="hidden" name="notify_url" value="http://localhost:1337/api/order/summary" required="required">
</form>
insight my angular controller (as Im using angular:
$scope.paypalPay=function(){
$('#pp').get(0).submit()
};
I'm trying to verify that user input in a UserName field is NOT in the format of an email address, using ng-pattern with Angular. The following code seems to produce the results I want, however the page loads with the error message showing until the user begins typing. The error goes away unless the users input matches the email address regex. How can I hide that message on page load and only show it when the regex it matched? Thanks.
<div ng-show="!form.UserName.$error.pattern" class="errorMessage">
Username is not your email address
</div>
<div class=" form-group">
<label class="form-label" for="userName">Username</label>
<input class="form-control" ng-pattern="/^([a-zA-Z0-9])+([a-zA-Z0-9._%+-])+#([a-zA-Z0-9_.-])+\.(([a-zA-Z]){2,6})$/" />
</div>
try to check if the input is "touched"
<div ng-show="form.UserName.$error.pattern && form.UserName.$touched" class="errorMessage">
Username is not your email address
</div>
I have a two forms in my application.
In the first one the user sets his data. When submitted the form data gets checked and an entry is made into a database with $http.
The second one is hidden and contains the payment parameters for either paypal or amazon payments.
I need one of two solutions (I can do A but my gut feeling is that B is better):
A)
Trigger the submit function of form B when the promise of form A's http is resolved.
This would be one solution which is not very good I guess:
HTML
<form method="POST" action="{{spendenController.paypal.actionUrl}}" target="_top" id="paypalForm">
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="{{spendenController.paypal.accountEmail}}">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="lc" value="DE">
<input type="hidden" name="amount" value="{{spendenController.spenden.amount}}">
<input type="hidden" name="item_name" value="Spende">
<input type="hidden" name="notify_url" value="{{spendenController.paypal.notifyUrl}}">
<input type="hidden" name="return" value="{{spendenController.paypal.successRedirectUrl}}" />
<input type="image" src="https://www.paypalobjects.com/de_DE/DE/i/btn/btn_donateCC_LG.gif" border="0" name="btnSubmit" alt="Jetzt einfach, schnell und sicher online bezahlen – mit PayPal.">
<img alt="" border="0" src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" width="1" height="1">
</form>
Controller
document.getElementById('paypalForm').submit()
B)
Or load a page with POST params directly from the controller/a service when the promise is resolved. In that case I wouldn't even need the second form.
Question: How to open a page with POST from the controller?
I do not just want to send POST data with $http.post I need the user to see the paypal checkout window in order to fulfill the payment.
I am using Paypal to accept payments on a website. Its working fine on the full size website but when I implement the same code on the mobile version of the website which runs jQuery mobile, the 'add to cart' button doesn't work.
I'm using website payments standard so its not as simple as adding "-mobile" as with the express checkout in this post: Paypal Checkout in mobile website
Paypal says the page should automatically re-direct but it doesn't.
My button is also not showing correctly which is rather strange. On my laptop (on mobile website) the button is stretched strangely, and on my phone (on mobile website) the button looks strange aswell.
Here is my code for the Paypal button:
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="ZQK9WXTYG3SDN">
<table>
<tr><td><input type="hidden" name="on0" value="Weekend Ticket Type">Weekend Ticket Type</td></tr><tr><td><select name="os0">
<option value="Full Price Weekend Ticket">Full Price Weekend Ticket £42.00 GBP</option>
<option value="Weekend Concession Ticket">Weekend Concession Ticket £40.00 GBP</option>
<option value="Under 12 Weekend Ticket">Under 12 Weekend Ticket £0.00 GBP</option>
</select> </td></tr>
</table>
<input type="hidden" name="currency_code" value="GBP">
<input style="padding:20px 0px 0px 0px;" width="120" type="image" src="http://www.website-domain.com/images/PayPal-button.jpg" border="0" name="submit" alt="PayPal — The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>
(I have changed the website domain name to stop it getting picked up in search engines ;-)
Many thanks in advance for your help
I suggest jQuery Mobile is hijacking your form submit (like it does with <a href=".."> tags too).
Try adding data-ajax="false"to your <form> tag.
You can find out more about this behaviour here:
http://jquerymobile.com/test/docs/forms/forms-sample.html
Or globally disable it by adding this snippet to your code:
$(document).bind("mobileinit", function(){
$.mobile.ajaxEnabled = false;
});