Email a form using PHP works intermittently
Hello all,
I'm using DW CS6/ Win 7. I have created a simple subscription form where the user enters their email and the form is emailed to an administrator. Sometimes it works and sometimes it doesn't and I have no idea why. Occasionally I receive the email after a delay of several minutes and sometimes it never arrives. The webpage is here www.sanbenitoolivefestival.com/contactus2.php , below is the script , I've tried in IE and FF, same intermittent results. I'm new to FF/ Firebug but it didn't report any errors that I could see
<div class="subscribe">
<div class="spacer"></div>
<?php
if ((isset($_REQUEST['email'])) && ($_REQUEST['email'] != " Enter Email Address"))
//if "email" is filled out, send email
echo "sending mail";
//send email
$email = $_REQUEST["email"] ;
$subject = "SBOF EMAIL SUBSCRIPTION REQUEST" ;
$message = "Please add my email address to the SBOF email subscription list" ;
mail("[email address removed by moderator]", $subject,
$message, "From:" . $email);
echo "Thank you, we have sent your subscription request";
else
//if "email" is not filled out, display the form
echo '<form action="contactus2.php" method="post" >
<em>Stay in touch by joining our email list.
<input name="email" type="text" value=" Enter Email Address" size="42" class="input" />
<input name="submit" type="submit" value=" SUBSCRIBE " class="button"/>
</em>
</form>';
?>
</div>
You are using an extremely insecure technique that lays your form wide open to a malicious attack known as email header injection, which can turn your form into a spam relay.
You should NEVER use unfiltered form input in the email headers. The From header is intended to indicate who sent the email. In this case, it's your website, not the person who fills out the form. If you want the convenience of hitting the reply button in your email program to use the sender's email address, you should use the Reply-to header instead of From.
Misusing the From header like this is one possible cause of your emails not getting through. You should also check with your hosting company to see if they require the fifth argument to mail() to be set. This is normally a string that begins with -f followed immediately by a known email address on the same domain as the server, for example '[email protected]'.
Also, using $_REQUEST is insecure.
Change your code like this:
<?php
if ((isset($_POST['email'])) && ($_POST['email'] != " Enter Email Address"))
//if "email" is filled out, send email
// make sure the email is OK
$email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
// send the message only if the email address is valid
if ($email) {
echo "sending mail";
//send email
$from = '[email protected]'; // this should be your own email address
$subject = "SBOF EMAIL SUBSCRIPTION REQUEST" ;
$message = "Please add my email address to the SBOF email subscription list" ;
$headers = "From: $from\r\nReply-to: $email";
$sent = mail("[email address removed by moderator]", $subject,
$message, $headers);
if ($sent) {
echo "Thank you, we have sent your subscription request";
} else {
echo 'Sorry, there was a problem sending your request';
else
//if "email" is not filled out, display the form
echo '<form action="contactus2.php" method="post" >
<em>Stay in touch by joining our email list.
<input name="email" type="text" value=" Enter Email Address" size="42" class="input" />
<input name="submit" type="submit" value=" SUBSCRIBE " class="button"/>
</em>
</form>';
?>
Similar Messages
-
I NEED HELP! Making a flash email form using php.
Hi, my name is Sean, I'm making a flash contact form using php for a website.
I'm having a hard time with the php. Can some one help?
Click here to download my source.Satellite A505-S6005
ACPI Flash BIOS version 1.40 for Satellite A500/A505 (PSAT6U/PSAT9U)
When you execute the download file (sat6v140.exe) it decompresses into several files in the sat6v140 folder.
Among those, is the readme.txt attached, which explains how to create the CD.
Burn a CD or DVD from an ISO file
-Jerry
Attachments:
readme.txt 14 KB -
hi all - i have an AS2 contact form using php to send the info to my email address - it all works fine except this ..... rather than having an empty comments box in the flash movie i had added a whole bunch of feedback questions that the user can comment yes/no to in the comments box (my feedback questions were added into the input text box in cs3 so are there when the user opens the contact page .. i have set the maximum characters to 10000 so no worries that its that that is stopping it all coming through in the email ..... basically when i go to my form online and send it i get it through as an email but with only three quarters of the feedback text in it ...... i have tried a zillion ways a round this, tried other contact forms and php and always end up with the same problem ... any ideas any one ?
this is the AS....
stop();
a =0;
function validate () {
if (from.length>=7) {
if (from.indexOf("@")>0) {
if ((from.indexOf("@")+2)<from.lastIndexOf(".")) {
if (from.lastIndexOf(".")<(from.length-2)) {
a = 1;
// email is fine
function formcheck () {
validate ();
trace(a);
if (fname = "" or telno eq "" or comments eq "" or from eq "") {
stop();
error = "You have left blank fields, please fill in all fields, thank you";
} else {
emailcheck ();
function emailcheck (){
if (a != 1){
stop();
error = "Email address not valid";
} else {
loadVariablesNum("mail.php3", 0, "POST");
gotoAndStop(2);
..........this is the php
<?php
$adminaddress = "[email protected]";
$sitename = "Flash Site Form Mailer";
mail("$adminaddress","Info Request",
"A customer at $sitename has made the following enquiry\n
First Name: $name
Company Name: $company
Telephone: $telno
Email: $from\n
The visitor commented:
$comments
Logged Info :
Using: $HTTP_USER_AGENT
Hostname: $ip
IP address: $REMOTE_ADDR
Date/Time: $date","FROM:$adminaddress");
?>
any help much appreciatedi think you should not use $HTTP_USER_AGENT.
and use loadvars instead of loadvariablesnum:
stop();
a =0;
function validate () {
if (from.length>=7) {
if (from.indexOf("@")>0) {
if ((from.indexOf("@")+2)<from.lastIndexOf(".")) {
if (from.lastIndexOf(".")<(from.length-2)) {
a = 1;
// email is fine
function formcheck () {
validate ();
trace(a);
if (fname = "" or telno eq "" or comments eq "" or from eq "") {
stop();
error = "You have left blank fields, please fill in all fields, thank you";
} else {
emailcheck ();
var sendLV:LoadVars=new LoadVars();
function emailcheck (){
if (a != 1){
stop();
error = "Email address not valid";
} else {
sendLV.name=fname;
sendLV.telno=telno;
sendLV.company=company; //assuming company is a variable in your flash
sendLV.comments=comments;
sendLV.send("mail.php3", "POST");
gotoAndStop(2);
//..........this is the php
<?php
$adminaddress = "[email protected]";
$sitename = "Flash Site Form Mailer";
$from=?;//you need to define this variable
$name=$_POST['name'];
$telno=$_POST['telno'];
$company=$_POST['company'];
$comments=$_POST['comments'];
$body=
"A customer at $sitename has made the following enquiry\n
First Name: $name
Company Name: $company
Telephone: $telno
Email: $from\n
The visitor commented:
$comments";
mail($adminaddress,"Info Request",$body);
?> -
I have just received a new iphone 5s and need to set the Apple ID with my work email. I used my work email on my personal iphone 4s to set up an icloud account and it will not let me use this email as the Apple ID on my new iphone. As it is a work phone I need to use this email address as my Apple ID. How do I do this?
when you open the app store scroll down to the bottom it will display the apple id currently in use, change it to your normal apple id email
-
Can't send Notes through email and it used to work. The same problem of sending picture from iPhone message. Did the reset twice but still not working
Try a reset:
Hold the Sleep and Home button down for about 10 second until you see the Apple logo. -
Email or store submitted PDF form using PHP
I'm using LiveCycle Designer 8.0. I've searched a lot but haven't seen any answers or solutions to submitting the filled out pdf form online and the pdf sending to an email without it having to use an email client on the users computer.
I'd prefer to use php and either save to the server or directly send the pdf as an attachment using the php mail() function. Any language would be fine, I'm just experienced with php.
If anyone would have a solution to this, I am fully capable of editing scripting to send the correct fields for my particular form. I've just not been able to find a way to store and attach in pdf format. Since the LiveCycle has the built-in function to open your default mail client, attach the pdf, and then send - isn't there some way that function could be edited to use the servers php mail feature instead?
Any help would be greatly appreciated. The reason this has become so important is that the new systems at some doctor's offices are requiring pdf's sent in advance that save in a program that allows the use of digital pen signing (like when you sign for a fedex package) of the documents once the patient arrives. And unfortunately, still many of the patients are not going to be avid pc users and will not have an email client program like outlook set up.
Thanks much,
HeatherThank you for your answer. I completely understand how to do all the things you mention, have been able to do them - where I can't seem to understand is posting to the web server. Maybe it's just simple and I'm overthinking it. When I set a url to post to, I've been trying to use a php script, but can't get the call right to save or grab the pdf.
Could you help me with that part? Are you meaning it that way - to post it to a script or am I over-doing it and there's a simpler way?
I appreciate your help very much.
Heather -
Moved from 104.11 to 10.5.2 php email feedback forms don't work now
Just moved from 10.4.11 to 10.5.2 with default Apache2 and PHP versions as provided by the 10.5 Server installer.
We have a simple web site, static pages, integrated filemaker content, and a couple of php scripts.
Our simple slideshow scripts work fine. Our feedback scripts do not.
User fills in the form and hits send which is set to post the field content to the php script with in turn sends an email to the appropriate address and then calls a "thank you for your submission" page. Until this OS change the browser never does anything other than what is described above. With the OS change the browser now looks like it is trying to load the script page and then gives this error:
"Safari can’t open the page “http://www.wetzelandson.com/feedback.php” because the server unexpectedly dropped the connection, which sometimes occurs when the server is busy. You might be able to open the page later."
The script runs some checks for empty fields, incomplete email address and verify that a mail server is on the domain for the users email address. The script works, diverting to error pages as needed, until the user puts in a complete email address at which point it stalls, shows that the browser is trying to load the php script and shows the message.Figured it out.
I guess something about the new php in 10.5.2 does not like the verification of an mx server at the domain of the users email
commented the following and script works fine now, it worked until I changed from 10.4.11 to 10.5.2.
I guess that this command is no longer valid.
function validateemail($email)
list($userName, $mailDomain) = split("@", $email);
return checkdnsrr($mailDomain, "MX");
if (validateemail($email))
*/ -
Parsing pdf form using PHP or JavaScript
Hello! How can I parse Pdf file with form to get fields position and page # of it?
For example, there are some pdf with structure like this:
<</AcroForm 23 0 R/Metadata 2 0 R/Outlines 6 0 R/Pages 9 0 R/Type/Catalog>>
endobj
19 0 obj
<</DA(/ZaDb 0 Tf 0 g)/FT/Btn/Ff 49152/Kids[18 0 R 20 0 R]/T(Language)>>
endobj
23 0 obj
<</DA(/Helv 0 Tf 0 g )/DR<</Encoding<</PDFDocEncoding 26 0 R>>/Font<</Helv 22 0 R/ZaDb 35 0 R>>/XObject<</DSz 51 0 R>>>>/Fields[19 0 R 21 0 R 39 0 R 16 0 R 17 0 R 46 0 R 47 0 R 48 0 R]/SigFlags 1>>
endobj
25 0 obj
<</BBox[0.0 0.0 72.0 20.0]/FormType 1/Length 102/Matrix[1.0 0.0 0.0 1.0 0.0 0.0]/Resources<</Font<</Helv 22 0 R>>/ProcSet[/PDF/Text]>>/Subtype/Form/Type/XObject>>stream
1 g
0 0 72 20 re
f
/Tx BMC
q
2 1 68 18 re
How can I get field position from this code using PHP or JavaScript?
Thanks.I solve my problem using Itext Pdf Library for Java. See here: http://stackoverflow.com/questions/19066141/itext-get-field-coordinate s-from-existing-pdf
-
Edit/delete/insert forms using php
Hi,
I have created an application that will allow me to
edit/delete/insert data to my database using php.
The functions work. But when I click on a tab i get an error
like this:
ypeError: Error #1009: Cannot access a property or method of
a null object reference.
at
StoreManagement/runFeed()[C:\adobeStoreManagement\StoreManagement\src\StoreManagement.mxm l:26]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at
mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\co re\UIComponent.as:9051]
at
mx.containers::ViewStack/dispatchChangeEvent()[E:\dev\3.0.x\frameworks\projects\framework \src\mx\containers\ViewStack.as:1165]
at
mx.containers::ViewStack/commitProperties()[E:\dev\3.0.x\frameworks\projects\framework\sr c\mx\containers\ViewStack.as:672]
at
mx.containers::TabNavigator/commitProperties()[E:\dev\3.0.x\frameworks\projects\framework \src\mx\containers\TabNavigator.as:504]
at
mx.core::UIComponent/validateProperties()[E:\dev\3.0.x\frameworks\projects\framework\src\ mx\core\UIComponent.as:5670]
at
mx.managers::LayoutManager/validateProperties()[E:\dev\3.0.x\frameworks\projects\framewor k\src\mx\managers\LayoutManager.as:519]
at
mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\3.0.x\frameworks\projects\frame work\src\mx\managers\LayoutManager.as:669]
at Function/
http://adobe.com/AS3/2006/builtin::apply()
at
mx.core::UIComponent/callLaterDispatcher2()[E:\dev\3.0.x\frameworks\projects\framework\sr c\mx\core\UIComponent.as:8460]
at
mx.core::UIComponent/callLaterDispatcher()[E:\dev\3.0.x\frameworks\projects\framework\src \mx\core\UIComponent.as:8403]
Also the first time I click on the edit program link it
doesnt show any data in the combo. Then when I click on new store.
It fills up the comboboxes. When I go back to the edit program tab.
It now also has the data inside the combobox.
When I add a new program, store or categorie. It says
operation succesfull. But the new program is not added to the new
comboboxes. I have to close the browser and rerun the application.
Then it shows the entered value inside the comboboxes.
I have attached all my code for this application, any help
would be greatly appreciated. Also could you advise me on what is
the best approach to do this?
With friendly regards,
ThomasA few things:
* Do not use lastResult in AS code. It is intended for use in
binding expressions only. I suspect that it is the cause of your
error, since it will not yet exist where you are trying to
reference it.
* All data service calls in Flex are asynchronous. this means
you can *never* access the result data in the same function you
call send(), as you are attempting.
* Use a result handler for all HTTPService calls
* Your data model methodology is *good*, using instance vars
to hold ArrayCollections, and binding to those vars. Just set the
vars in a result handler, instead of in the send function
* the default resultFormat of HTTPService is object. This
causes Flex to convert the HTTPService XML into a tree of dynamic
objects. While it provides a quick start, it has long term
drawbacks. I advise setting resultFormat="e4x", so that youcan use
the powerful e4x XML API on your data. -
Sending email from forms using 'from'
I'm trying to send an email from forms. It goes well, but I like to use the 'from' field from Outlook. How can I use it in OLE? I have searched everywhere, but can't find it.
It seems to me it is something like the way you do with BCC and CC options, but I haven't found a way to do the same thing with the From field. Can anyone help?
Thanks,
Pauline KooyFabrizio,
Are you just sending the Line Feed character 'CHR(10)"? I typically send the Carrage Return character 'CHR(13)' as well. I'll create a variable called CRLF and assign the Carrage Return and Line Feed characters to this variable. Then reference the CRLF variable when I want to embed a new line.
For example:
DECLARE
crlf VARCHAR2(2) := chr(13)||chr(10);
v_msg_body VARCHAR2(2000);
BEGIN
v_msg_body := 'lots of text here'||crlf;
END;Hope this helps.
Craig... -
Pass/retrieve data to PDF form using php
Hi
We are trying to build an application that goes like this.
Web based application. Document template is uploaded. User can open the template, fill in data, and save the form. PHP , Mysql
We are stuck at the stage where we need to pass some data via php into the form and then extract the filled in data from the form via php.
Does anyone have a solution to this.
Thanks
Sam
zhhealthcareTry googling "iText".
iText is JAVA based, and is capable of creating and manipulating FDF data.
For a Microsoft .net version, check out "iTextSharp", or "FDFToolkit.net"
Hope this helps... -
Forms just stop working intermittently when using Excel too
I have a random, strange and frustrating problem! I am working in R12.0.4 doing some testing, which means I need to keep referring to an Excel spreadsheet (version 2007), so I frequently switch between Oracle Forms and Excel - sometimes by clicking between and sometimes using Alt-Tab. What happens, intermittently - sometimes frequently and sometimes not - is that when I return to Oracle, the form stops working - I can't tab through the fields, I can't select any buttons, I can't even hit the 'quit' icon in the top right corner. My only way out is to close the J-Initiator window (which in turn closes the forms session) and to then re-start my forms session from the Apps Home Page.
Has anyone else come across this?
Thanks in advance.
JoHello!
Finally I have encountered the issue again (I said it was intermittent)!
Here is a copy of the error message in the java console:
Exception in thread "AWT-EventQueue-2" java.lang.IllegalStateException: cannot open system clipboard
at sun.awt.windows.WClipboard.openClipboard(Native Method)
at sun.awt.datatransfer.ClipboardTransferable.<init>(Unknown Source)
at sun.awt.datatransfer.SunClipboard.getContents(Unknown Source)
at oracle.forms.ui.delegates.VComponentDelegate.handleOKToPaste(Unknown Source)
at oracle.forms.ui.delegates.VCommonTextDelegate.getProperty(Unknown Source)
at oracle.forms.ui.delegates.VTextFieldDelegate.getProperty(Unknown Source)
at oracle.forms.ui.VTextField.getProperty(Unknown Source)
at oracle.forms.handler.ComponentItem.focusGained(Unknown Source)
at oracle.forms.handler.TextComponentItem.focusGained(Unknown Source)
at oracle.forms.handler.TextFieldItem.focusGained(Unknown Source)
at java.awt.AWTEventMulticaster.focusGained(Unknown Source)
at java.awt.Component.processFocusEvent(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.processFocusEvent(Unknown Source)
at oracle.ewt.lwAWT.lwText.LWTextComponent.processFocusEvent(Unknown Source)
at oracle.ewt.lwAWT.lwText.LWTextField.processFocusEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.processEventImpl(Unknown Source)
at oracle.ewt.lwAWT.lwText.LWTextComponent.processEventImpl(Unknown Source)
at oracle.ewt.lwAWT.lwText.LWTextField.processEventImpl(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.redispatchEvent(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.SequencedEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Hopefully that will be meaningful to one of you. I notice it says something about a clipboard - just in case it matters, I am NOT trying to copy and paste between the applications.
Thanks,
Jo -
Email from form using developer 6i
Hi,
Could anybody help me to resolve the below mentioned problem. I wanted to call "Outlook" Mailto: from a form where my email address is entered. How can I do this in forms 6i.
PG Anil.I'm not sure what you mean by the "SQL Net client" not being compatible.
We have one client using Oracle 11g and one on Oracle 9. I can still connect and test all of our Forms 6i client/server forms to BOTH databases and run tests successfully.
As long as the new database is not using the AL32UTF8 character set, and Forms users have all Upper-case passwords, all seems to work ok.
Edit: Following tony.g's note below: I have Patch 18 installed on Forms 6i, so it runs version 6.0.8.27.0
Edited by: Steve Cosner on Oct 31, 2012 9:38 AM -
How does general web public email the form using reader only
After producing a form in Designer no one was able to email the filled in form back. Is there some very basic step I missed? I had a submit button with my email address entered yet everyone with reader was unable to get the form emailed. If I didn't miss something I guess I don't see the point of creating the form if you need a full version to respond.....
I did upgrade one of the testers to Reader 7 and it worked. I may have to save the form in two files one for 7 and one for Reader6. The submit by email did function but I had also changed the button and used the one from the Library and set the address to mailto:myemailaddress. What that did was return a .tmp file. So I dragged in a default button from a new file and that corrected it - that one seems to not have the 'mailto' prefix and must have some built in coding to return the data in XML.
Submiting the data to a server doesn't make much sense unless you have some method of getting the data from the server. Is there such a method built into this program or does that require additional coding? -
I'm trying to send an email with PHP5 from my local computer,
apache, and php5
I keep getting a STARTTLS error. trying to us gmail to
send...any ideas?Steve wrote:
> On Sat, 25 Nov 2006 05:35:31 +0000 (UTC), "South Beach"
> <[email protected]> wrote:
>
>> I'm trying to send an email with PHP5 from my local
computer, apache, and php5
>>
>> I keep getting a STARTTLS error. trying to us gmail
to send...any ideas?
>
> Have you set up sendmail correctly?
Another consideration is that gmail requires a username and
password.
PHP mail() function does not support SMTP authentication. To
send a
username and password to gmail, you need to use a custom
class like
PHPMailer.
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/
Maybe you are looking for
-
Error in writing to directory /tmp/OraInstall2009-09-18_09-03-18AM. Please
Hi all, oracle Unbrekable linux 32 bit oracle 10.2.0.1 i got this error while installing oracle universal installer [vishal@localhost database]$ ./runInstaller Starting Oracle Universal Installer... Checking installer requirements... Checking operati
-
Error while deploying ear using Oracle weblogic 11g in local machine
Hi, Initially I installed Jdeveloper along with Weblogic and got the below error while deploying. Later I uninstalled Jdeveloper and weblogic, etc and installed a new weblogic on my local machine and tried to deploy ear. But still got the same error.
-
Safari crash after 10.7.1 update
Safari continues to cause problems to my entire system when viewing youtube or other web embedded video content. After installing the 10.7.1 update, I opened youtube and started a video, the player would rapidly stop, start, stop, start, the cursor w
-
web links do not show as visited according to my color selection in content menu. visited sites/links should be in red, mine are not changing after a visit to a sits. A good example would be a visit to a news article in google. mu colors are set to r
-
X6 v20.0.005 update--post bugs/problems here
So far I've noticed: 1-Can't create new profiles anymore-try it in "Settings-Personal-Profles-Options-Create new" 2-After disconnecting from Ovi Store have to manually disconnect from Internet connection 3-Not much (any?) difference between 3 degree