HTML form - check if email entered correctly? - forms

I creating Contact us form and i want in email section that if email entered wrong way (not name#example.com), user wouldn't be able to submit form.
input:
<input name="email" type="text" value="" size="30"/>

With regexp using javascript/php (or whatever) you would be able to validate an email format : presence of "#", presence of ".dom", but you will have to hard code to avoid something like "example.com".
I would suggest to use a validation/activation mechanism : send an email with a link, when user click the link you receive a notification, that means that email is valid so you can take care of it !
You can check this topic : Validate email address in JavaScript?
But it does not take care about something like "name#example.com".
As Mike W said in comments, the only way to validate a valid email is to send an email.
Also, you could have fun trying to trap auto-response for invalid email by checking the sender mailbox ;)

Related

how could I recognize an email as auto-forward email?

I have a task which needs me to find out the auto-forward email from an email set.
Originally I recoginize an email whose sender contains "caf_|auto_" and "+" and "_" as auto-forward email,for example "test3128+caf_=test3128=yahoo.com#gmail.com".
But finallly I find that the above-mentioned feature is not always right.Because the email may be an auto-forward or an auto-reply email.
Could anyone give me any help?You have my thanks.

Sitecore ECM: User unsubscribing newsletter receives no confirmation email

My unsubscribe-link does not work properly. The user IS moved from Opt-in into Opt-out, but receives no confirmation email. Do I have to do anything to make that happen?
Note that I have not altered anything in /sitecore/content/ECM/[MyTarget Audience]/Standard Messages/Self-Service Subscription/Unsubscribe Notification.
In my footer I link to a existing unsubscribe.aspx I have found:
<a href="/sitecore/Unsubscribe.aspx">
<unsubscribe>
<sc:Text runat="server" Field="Unsubscribe" Item="<%# this.DataSource. %>" />
</unsubscribe>
</a>
In the email this is transformed into
<a href="http://www.multi-wing.com/sitecore/RedirectUrlPage.aspx?ec_url=%2fsitecore%2fUnsubscribe.aspx&ec_camp=A0D5584059504B85A3E3317B306A0411&ec_as=B9844EF7C873423FA9C369890E9354E8">
<unsubscribe>Unsubscribe</unsubscribe>
</a>
As I said the user IS being unsubscribed, but what do I have to do to make sure he/she receives an email confirmation?
If you've setup ECM with default settings it should just send automatically. If you have ECM sending emails then this should also be working.
Check your spam filter or your junk. This kind of notification get's junked all the time due to the format of the email.

How to embed the consistent data in HTML Email

How could I have something like <b>Case ID</b> : <span id="caseDtl_caseId">00004</span> in HTML email consistently? I have found that when the email was replied, the id attribute is lost. Or is there the better way to retrieve the information from non-formed email?
Regards,
Why don't use the Message Headers instead, eg if your generating the Message you could set/store the MessageID of the message you send and then use the In-Reply-To header to identify responses https://www.rfc-editor.org/rfc/rfc4021#page-10, Or use the Thread-Index/ConversationId properties like the Mail Clients do to track messages in a thread.
Cheers
Glen

Drupal Webform email receipt

I'm trying to set up an email receipt to send to the user who fills out the form.
I'm using Webform 6.x-3.1. On this help page for Webform "admin/help/webform" it hints at that function by stating this "Once finished adding fields, you may want to send e-mails to administrators or back to the user who filled out the form. Click on the Emails sub-tab underneath the Webform tab on the piece of content."
It looks like they took out the "Additional processing" ability with this version.
I tried adding an hidden email field under the "E-mails" tab to send an email to the form submitter but didn't work. What I di was add a hidden field called "email_user" and for the default value, gave it %post[email] because the email field they fill out is "email". It doesn't look like it's grabbing the post.
Does anyone have this working or understand how to get it done?
I think you might be misunderstanding the E-mails subtab. For an example, start fresh with a new Webform node and try this:
In the "Form components" subtab, add three components: "Example First Name" (type: textfield), "Example Last Name" (type: textfield), and "Example Email Address" (type: email). For this example, mark them all as "Mandatory" (although I don't think that setting is required for confirmation emails).
Check out the "E-mails" subtab. See how the "Component value:" dropdown now displays "Example Email Address" as an option? Leave that selected, and click on the "Add" button to the right.
On the next page, you can define the email header and body, as I'm sure you've seen before. Note at the top, however, the E-mail to address: field, which still has your "Example Email Address" component selected. This means that the confirmation email will be sent to the email address that is entered in the Example Email Address form field upon submission.
Now click the "View" tab and try out your form: Enter an example name and a real email address, submit, and check to see if you receive the Webform-generated confirmation email.
In short: you don't use the E-mails subtab to define additional fields/components for your form; you use it to select which existing form field(s) should be the recipient of a confirmation email.

Can I send a variable to paypal, and have it post it back to me when payment completes?

Ive been using express checkout API to convert people's accounts on my site to premium accounts after paying. The only problem with it is that it doesn't send the user back to the site until they click the button to return, and it updates their permission when that happens. About 40% of the users don't seem to do that.... so their accounts never get credited after payment.
Although paypal does an instant post-back upon the successful payment, I was never able to make it actually update the user's account right away, since I cant get it to send back some sort of informational that would identify the user that just completed the payment. I could only do that when you are sent back to the site, which sends the transaction ID, that I logged with a post-back. It searches for it, and grants permission if it was found int he DB.
Is there a way to submit some sort of a variable to paypal, that it will then post back to me? Something like &user_id=123, which would make it very handly to update the user's permission.
Iten_number hidden variable don't work in my application. But i found that custom hidden field works fine. Just add this field to the form, generated by paypal: <input type="hidden" name="custom" value="YOUR VALUE FROM DB"/>. After, you can read this value to identify, for example, what product have been purchased. (Java code): String custom = request.getParameter("custom");
Yes, if you send item_number, the IPN notification will include that when it posts back to you. I record a unique ID in the database when the user starts the payment process, and include that when sending them to PayPal. When the IPN comes in, that unique ID matches up with the record in the database, giving me all the info I need.
Edit Re your comment:
I expect there's a code example somewhere on the site linked above, but basically in my case I'm using a form that I POST to https://www.paypal.com/cgi-bin/webscr. Within that form are various hidden fields documented in the IPN stuff (cmd for what command to perform, business to specify your business ID, item_name for a nice description in the PayPal UI, item_number for the item number I mentioned above, etc., etc.). When IPN posts back to your IPN address, it includes various fields (such as payment_status — kind of important! &mdash and the item_number you fed in when posting to them).
Just to add to this old question...
There are option parameters that are commonly used for custom data sending through paypal.
These option tags are on0, on1, or on2 for the custom field names and os0, os1, and os2 for the custom field values.
I would send on0 with a value of "UserID" and os0 the actual ID.
These values will be represented in the IPN as follows:
os0 is represented as option_selection1
os1 is represented as option_selection2
os2 is represented as option_selection3
on0 is represented as option_name1
on1 is represented as option_name2
on2 is represented as option_name3
Here's the info on PayPal's HTML parameters
According to HTML Variables for PayPal Payments Standard you can send all the "Pass-through" variables:
item_number Pass-through variable for you to track product or service
purchased or the contribution made. The value you specify is passed
back to you upon payment completion. This variable is required if you
want PayPal to track inventory or track profit and loss for the item
the button sells.
custom Pass-through variable for your own tracking purposes, which buyers do not see. Default – No variable is passed back to you.
and
invoice Pass-through variable you can use to identify your invoice number for this purchase. Default – No variable is passed back to
you.
All these pass-through variables are sent back by the IPN in the payment response info.
You just have to render your HTML template server-side and write the fields back in the HTML code like
<input type="hidden" name="item_number" value="{{ productID }}">
<input type="hidden" name="invoice_id" value="{{ invoiceID }}">
<input type="hidden" name="custom" value="{{ jsonInfo }}">
Technically the field "custom" can be a JSON encoded string if you want to handle more data like
myItemObject = {
"customerEmail" : "john#doe.com
"customerID: "AAFF324"
}
jsonInfo = json.dumps( myItemObject )
return render_template(tmpl_name, jsonInfo=jsonInfo, productID=productID, invoiceID=invoiceID)
I finally get this answer, I want to share with all of you look:
on your HTML form put this code (this is Paypal sandbox):
form action="https://www.sandbox.paypal.com/cgi-bin/webscr?custom=YOUR_VAR" method="post"
On your PHP after the Paypal redirect to your page success: use the cm GET variable:
$example = $_GET["cm"];
I hope this URL solves your issue. As it solved mine as well. Add a custom variable to your form and then retrieve it on your success payment page.
Example :
<input type='hidden' name='custom' value='<?php echo $email; ?>'/>
and then retrieve it as :
$_POST['custom']
<input type="hidden" name="on0" value="Ajay Gadhavana">
<input type="hidden" name="on1" value="my_phone_number">
<input type="hidden" name="on2" value="my_third_extra_field">
Response from paypal would be
[option_name1] => Ajay Gadhavana
[option_name1] => my_phone_number
[option_name1] => my_third_extra_field
What worked for me in 2021 is passing "custom_id" (inside the "purchase_units" array) to PayPal in my client app and checking "custom" on my backend.
Yes, it looks like PayPal renames the parameter for some reason.