Developer Support »

Snippet of code I could enter that would ensure the email address had to include .gov.uk  (See more user questions)

Thank you, , very kind of you.

My pleasure to assist.

Any questions, just let me know.

Best wishes.

Charles Sweeney
https://formtoemail.com
The world's easiest feedback script!

----- Original Message -----
Sent: Thursday, October 22, 2009 9:02 AM
Subject: Re: Re: FormToEmail-Pro script


> Hi Charles
>
> I've been away for a while so haven't had the opportunity to thank you for
> this.
>
> I haven't been able to try it yet, but I'll be using it over the next week
> or so and I'm sure it will do the job perfectly.
>
> Thanks again for your time and assistance.
>
> On 3 Sep 2009 19:30, "FormToEmail.com" wrote:
>> Hello again, .
>
>
>
>> Thank you very much for your feedback!
>
>
>
>> I had a look at this, using one script to handle the different
>> autoresponder attachments, depending on the submitting form. You could
>> try this:
>
>
>
>> First, you need to identify each form, say with a hidden input like this:
>
>
>
>
>
>
>
>> ...put the input on every form and just change the value for each form.
>
>
>
>> Then on the script, locate this line:
>
>
>
>> $autoresponder_attachment_file = "";
>
>
>
>> Replace it with this:
>
>
>
>> if(isset($_REQUEST['form_ID']) && $_REQUEST['form_ID']
>> == "form_1"){$autoresponder_attachment_file = "attachment_1.pdf";}
>
>
>
>> So for three forms, the code in the script would be:
>
>
>
>> if(isset($_REQUEST['form_ID']) && $_REQUEST['form_ID']
>> == "form_1"){$autoresponder_attachment_file = "attachment_1.pdf";}
>
>
>
>> if(isset($_REQUEST['form_ID']) && $_REQUEST['form_ID']
>> == "form_2"){$autoresponder_attachment_file = "attachment_2.pdf";}
>
>
>
>> if(isset($_REQUEST['form_ID']) && $_REQUEST['form_ID']
>> == "form_3"){$autoresponder_attachment_file = "attachment_3.pdf";}
>
>
>
>> Upload all the attachment files to the same directory.
>
>
>
>> See how it goes.
>
>
>
>> Best wishes.
>
>
>
>> Charles Sweeney
>
>> https://formtoemail.com
>
>> The world's easiest feedback script!
>
>
>
>> ----- Original Message -----
>
>
>> Sent: Thursday, September 03, 2009 5:35 PM
>
>> Subject: Re: FormToEmail-Pro script
>
>
>
>
>
>
>> Thanks for the support, Charles. I've got everything working as it should
>
>> now by using multiple scripts.
>
>
>
>> I'll certainly be recommending you to others.
>
>
>
>> Thanks again
>
>
>> On Fri, Aug 28, 2009 at 8:09 PM, FormToEmail.com
>> wrote:
>
>
>
>
>> Hi
>
>
>
>> My pleasure to assist.
>
>
>
>> I don't have a donate page, but if you find yourself on my feedback page,
>
>> here:
>
>
>
>> https://formtoemail.com/funkyfeedback/funkyfeedback.php
>
>
>
>> ...feel free to donate some feedback!
>
>
>
>> On the face of it, a solution would be to make 28 copies of the script.
>
>> Otherwise you are really looking at a custom-coded solution. There's only
>
>> so much you can do with a stock script. Leave it with me though, I'll
>> have
>
>> a think about it.
>
>
>
>> As it stands. The autoresponse only attaches one file. What about putting
>
>> the files into a single zip file?
>
>
>
>> Best wishes.
>
>
>
>> Charles Sweeney
>
>> https://formtoemail.com https://formtoemail.com/>
>
>> The world's easiest feedback script!
>
>
>
>> ----- Original Message -----
>
>> Sent: Friday, August 28, 2009 6:32 PM
>
>
>
>> Subject: Re: FormToEmail-Pro script
>
>
>
>
>
>> Hi Charles
>
>
>> Thanks for your continuing support and for checking out the script. Do
>> you
>
>> have a PayPal donate page anywhere?
>
>
>
>> I don't know what was going on but it seems to working fine now. I've
>
>> changed the $my_email to an alternative address and all is OK.
>
>> I may be asking too much here but is there any code I could use that
>> would
>
>> send a specific attachment depending on which form has accessed the
>
>> script?
>
>
>
>> What I am doing is setting up a range of 28 different documents that can
>
>> be
>
>> requested using 28 different forms (it has to be separate forms). Do I
>
>> need
>
>> to use a separate script for each form or could I use a piece of code
>> that
>
>> would automatically send attachment_1.pdf if the request came from
>
>> form_1.php and attachment_2.pdf if requested by form_2.php etc. etc?
>
>
>
>> It would simplify the process greatly and easier for me to make global
>
>> changes to the system if any configuration changes are necessary at a
>
>> later
>
>> date.
>
>
>
>> Also, is it possible to send two or more attachments with the
>
>> autoresponder?
>
>
>
>
>> On Thu, Aug 27, 2009 at 9:04 PM, FormToEmail.com
>
>> >wrote:
>
>
>
>> Hi
>
>
>
>
>> My pleasure to assist.
>
>
>
>> I tried your script EXACTLY as you gave it to me, but changed the
>
>> $my_email
>
>> address to my own. I got the email as expected.
>
>
>
>> The problem must be on the receiving end with your
>
>> .net address. Try it with your gmail address,
>
>> just
>
>> to see.
>
>
>
>> Charles Sweeney
>
>> https://formtoemail.com https://formtoemail.com/>
>
>> The world's easiest feedback script!
>
>
>
>> ----- Original Message -----
>
>> Sent: Thursday, August 27, 2009 8:39 PM
>
>
>
>> Subject: Re: FormToEmail-Pro script
>
>
>
>
>
>> Well, I thought it was strange that it did but, as it only seems to
>
>> happen
>
>
>
>
>> with the new code in, I thought it must be that.
>
>
>
>> I've attached the copy of the code as requested.
>
>
>
>> Thanks for your help with this, it really is appreciated.
>
>
>
>> On Thu, Aug 27, 2009 at 8:20 PM, FormToEmail.com
>
>> >wrote:
>
>
>
>> Hi
>
>
>
>
>
>
>> The code I gave you has no effect on the $my_email address that you
>
>> hard-code into the script.
>
>
>
>> Have you altered the script in any way? Attach a copy of your script
>
>> (with
>
>> the new code in it) and I will have a look at it.
>
>
>
>> Best wishes.
>
>
>
>> Charles Sweeney
>
>> https://formtoemail.com https://formtoemail.com/>
>
>> The world's easiest feedback script!
>
>
>
>> ----- Original Message -----
>> Sent: Thursday, August 27, 2009 8:06 PM
>
>> Subject: Re: FormToEmail-Pro script
>
>
>
>
>
>> Hi Charles
>
>
>
>
>
>
>> Thank you for such a swift response and solution; I couldn't believe
>
>> you'd
>
>> replied so quickly.
>
>
>
>> I've entered the code and it works just fine at only allowing
>
>> .gov.ukemails. Unfortunately, it seems to be working so well that it
>
>
>
>> blocks the
>
>> email that carries the form content! - ie it sends the autoresponder
>
>> and
>
>> attachment to the user, but it doesn't send the form content to me,
>
>> presumably because my business email isn'ta .gov.uk address. I think
>
>> it
>
>> must be the code that's blocking it as, when I take the code out it
>
>> sends
>
>> it, as soon as I put it back in it stops being delivered, even though
>
>> the
>
>> mail and attachment arrive at the .gov.uk address.
>
>
>
>> The address I need the form to go to is .netis
>
>> there
>
>> a way of overriding the code for this address only?
>
>
>
>> Thanks in advance.
>
>
>
>> Martin Foster
>
>
>
>> On Thu, Aug 27, 2009 at 4:26 PM, FormToEmail.com
>>
>
>> >wrote:
>
>
>
>> Hi
>
>
>
>
>
>> Thank you very much for your kind words! Glad to be of service.
>
>
>
>> Yes, I can do that for you. Locate this code in the script (note the
>
>> curly
>
>> bracket):
>
>
>
>> // Validate email field.
>
>
>
>> if(isset($_REQUEST['email']) && !empty($_REQUEST['email']))
>
>> {
>
>
>
>> Below it, add this line:
>
>
>
>> if(!stristr($_REQUEST['email'],".gov.uk")){$errors[] = "Non valid
>
>> email
>
>> address";}
>
>
>
>> ...so you end up with this:
>
>
>
>> // Validate email field.
>
>
>
>> if(isset($_REQUEST['email']) && !empty($_REQUEST['email']))
>
>> {
>
>
>
>> if(!stristr($_REQUEST['email'],".gov.uk")){$errors[] = "Non valid
>
>> email
>
>> address";}
>
>
>
>> $_REQUEST['email'] = trim($_REQUEST['email']);
>
>
>
>> etc etc
>
>
>
>> Save the file and upload it.
>
>
>
>> Some points. The above code assumes that the email input on the form
>
>> is
>
>> named "email". I have deliberately used a different error message
>
>> ("Non
>
>> valid email address") to distinguish it from the normal invalid email
>
>> error
>
>> message. You can change the message to suit. Personally I wouldn't
>
>> give
>
>> away any clues in an error message if I could avoid it. I wouldn't
>
>> say
>
>> "email address must be .gov.uk", that might be helpful to someone
>
>> trying
>
>> to infiltrate your system! I'll leave that to you!
>
>
>
>> Any questions, just let me know.
>
>
>
>> Best wishes.
>
>
>
>> Charles Sweeney
>
>> https://formtoemail.com https://formtoemail.com/>
>
>> The world's easiest feedback script!
>
>
>
>> ----- Original Message -----
>> Sent: Thursday, August 27, 2009 3:04 PM
>
>> Subject: FormToEmail script
>
>
>
>
>
>> Comments: Hi
>
>
>
>> I'm using the pro version of FormToEmail and would like to
>
>> congratulate
>
>> you on providing such a robust and versatile script.
>
>
>
>> I am currently designing a form that I only want social care
>
>> professionals
>
>> to complete as it will trigger an autoresponder with an attachment
>
>> that
>
>> contains confidential information. Therefore, I only want holders of
>
>> .
>
>> gov.uk email addresses to be able to use the service. At present, I
>
>> have
>
>> worked around this by entering .com, .co.uk etc into the blocked
>
>> words
>
>> section of the script. However, there are too many extensions
>
>> worldwide
>
>> for
>
>> me to close the loophole completely. I was wondering whether there
>
>> was
>
>> a
>
>> snippet of code I could enter that would ensure the email address
>
>> had
>
>> to
>
>> include .gov.uk?
>
>
>
>> Any help you could offer would be greatly appreciated.
>
>
>
>> Many thanks