Any ideas on what my PHP file should look like...
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Any ideas on what my PHP file should look like...
...to collect this information out of LiveCode?
if the hilite of button "IAgree" then
put "myemailXaddressXcom" into tRecipient
put "LoanApp" into tSubject
put selectedText of button "CUlist"& the text of field "MembNmbr"& the text of field "FirstField"& the text of field "LastField" & the text of field "teleField"& the text of field "AltField"& the text of field "EmailField"& the text of field "IncomeField" into tMsg
get libURLFormData("Recipient", tRecipient,"Subject", tSubject,"Msg",tMsg)
post tMyData to URL"My directory to the App.php"
answer "Submited Successfully"
Here is what I have (not much I know):
<?php
$tRecipient = ???THE EXISTING DATA FROM LIVECODE???;
$tSubject = ???THE EXISTING DATA FROM LIVECODE???;
$tMsg = ???THE EXISTING DATA FROM LIVECODE???;
mail($tRecipient,$tSubject,$tMsg);
echo "Mail Sent.";
?>
I am not sure how to call out the existing information from livecode into the php file.
Any help is very much appreciated!
Sincerely,
Rae
if the hilite of button "IAgree" then
put "myemailXaddressXcom" into tRecipient
put "LoanApp" into tSubject
put selectedText of button "CUlist"& the text of field "MembNmbr"& the text of field "FirstField"& the text of field "LastField" & the text of field "teleField"& the text of field "AltField"& the text of field "EmailField"& the text of field "IncomeField" into tMsg
get libURLFormData("Recipient", tRecipient,"Subject", tSubject,"Msg",tMsg)
post tMyData to URL"My directory to the App.php"
answer "Submited Successfully"
Here is what I have (not much I know):
<?php
$tRecipient = ???THE EXISTING DATA FROM LIVECODE???;
$tSubject = ???THE EXISTING DATA FROM LIVECODE???;
$tMsg = ???THE EXISTING DATA FROM LIVECODE???;
mail($tRecipient,$tSubject,$tMsg);
echo "Mail Sent.";
?>
I am not sure how to call out the existing information from livecode into the php file.
Any help is very much appreciated!
Sincerely,
Rae
Re: Any ideas on what my PHP file should look like...
Hi,
This LiveCode script should be sufficient:
constant amp = "&"
If this doesn't work, then we might have to look into a multi-part approach. The PHP script for the above LiveCode script would be:
Hopefully I didn't make any typos. You may have to change the encoding in $header and of course you need to adjust your own e-mail address. Probably, the From e-mail address must be a valid e-mail address for which there is an account on the sending server.
If you don't want to, you don't need to assign the $_POST to variables first. You can concatenate the $_POST elements directly.
Let me know if this works (or not).
kind regards,
Mark
This LiveCode script should be sufficient:
constant amp = "&"
Code: Select all
on sendMail
if the hilite of button "IAgree" then
put "rcpnt=" & urlEncode("myemailXaddressXcom") & amp & \
"subj=LoanApp" & amp & \
"cu=" & urlEncode(the selectedText of button "CUlist") & amp & \
"mn=" & urlEncode(field "MembNmbr") & amp & \
"ff=" & urlEncode(field "FirstField") & amp & \
"lf=" & urlEncode(field "LastField") & amp & \
"tf=" & urlEncode(field "teleField") & amp & \
"af=" & urlEncode(field "AltField") & amp & \
"ef=" & urlEncode(field "EmailField") & amp & \
"if=" & urlEncode(field "IncomeField") into myParams
post myParams to URL "http://localhost/My%20directory%20to%20the%20App/file.php"
if the result is empty then answer "Submited Successfully"
end if
end sendMail
Code: Select all
<?php
$rcpnt=$_POST["rcpnt"];
$subj=$_POST["subj"];
$cu=$_POST["cu"];
$mn=$_POST["mn"];
$ff=$_POST["ff"];
$lf=$_POST["lf"];
$tf=$_POST["tf"];
$af=$_POST["af"];
$ef=$_POST["ef"];
$if=$_POST["if"];
$s=" "; //space
$msg=$cu.$s.$mn.$s.$ff.$s.$lf.$s.$tf.$s.$af.$s.$ef.$s.$if;
$header = "From: Your Name <your@mail.com>\r\n" .
"MIME-Version: 1.0\r\n" .
"Content-type: text/plain; charset=latin-1\r\n" .
"\r\n";
$rslt = mail($rcpnt,$subj,$msg,$header);
if (!$rslt)
echo 'An error occurred';
else echo 'Mail sent';
?>
If you don't want to, you don't need to assign the $_POST to variables first. You can concatenate the $_POST elements directly.
Let me know if this works (or not).
kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Any ideas on what my PHP file should look like...
Hi Mark,
This looks really good; thanks! I didn't see any typos but, unfortunately, it did not work for me. I did have to edit out the from e-mail address reference as this is generated as a valid e-mail address from the sending server (just like you said). I used the livecode you provided in full but this is how I edited the php you provided:
<?php
$rcpnt=$_POST["rcpnt"];
$subj=$_POST["subj"];
$cu=$_POST["cu"];
$mn=$_POST["mn"];
$ff=$_POST["ff"];
$lf=$_POST["lf"];
$tf=$_POST["tf"];
$af=$_POST["af"];
$ef=$_POST["ef"];
$if=$_POST["if"];
$s=" "; //space
$msg=$cu.$s.$mn.$s.$ff.$s.$lf.$s.$tf.$s.$af.$s.$ef.$s.$if;
"MIME-Version: 1.0\r\n" .
"Content-type: text/plain; charset=latin-1\r\n" .
"\r\n";
$rslt = mail($rcpnt,$subj,$msg);
if (!$rslt)
echo 'An error occurred';
else echo 'Mail sent';
?>
Did I miss something or take out too much?
Thanks,
Rae
This looks really good; thanks! I didn't see any typos but, unfortunately, it did not work for me. I did have to edit out the from e-mail address reference as this is generated as a valid e-mail address from the sending server (just like you said). I used the livecode you provided in full but this is how I edited the php you provided:
<?php
$rcpnt=$_POST["rcpnt"];
$subj=$_POST["subj"];
$cu=$_POST["cu"];
$mn=$_POST["mn"];
$ff=$_POST["ff"];
$lf=$_POST["lf"];
$tf=$_POST["tf"];
$af=$_POST["af"];
$ef=$_POST["ef"];
$if=$_POST["if"];
$s=" "; //space
$msg=$cu.$s.$mn.$s.$ff.$s.$lf.$s.$tf.$s.$af.$s.$ef.$s.$if;
"MIME-Version: 1.0\r\n" .
"Content-type: text/plain; charset=latin-1\r\n" .
"\r\n";
$rslt = mail($rcpnt,$subj,$msg);
if (!$rslt)
echo 'An error occurred';
else echo 'Mail sent';
?>
Did I miss something or take out too much?
Thanks,
Rae
Re: Any ideas on what my PHP file should look like...
Rae,
"It doesn't work" is insufficient information. Please, provide all possible details and I really mean all.
Kind regards,
Mark
"It doesn't work" is insufficient information. Please, provide all possible details and I really mean all.
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Any ideas on what my PHP file should look like...
When I change this:
$rcpnt=$_POST["rcpnt"];
to this:
$rcpnt="myemailaddress@address.XXX";
I get the email but none of the data from my livecode fields is in it.
Previously I didn't get an email at all.
Does this help? Please let me know if you need additional information.
Thank you so much for your help.
-Rae
$rcpnt=$_POST["rcpnt"];
to this:
$rcpnt="myemailaddress@address.XXX";
I get the email but none of the data from my livecode fields is in it.
Previously I didn't get an email at all.
Does this help? Please let me know if you need additional information.
Thank you so much for your help.
-Rae
Re: Any ideas on what my PHP file should look like...
Hi Rae,
Perhaps your server doesn't accept such a long post and multiform posting is indeed required. Let's try this:
Kind regards,
Mark
Perhaps your server doesn't accept such a long post and multiform posting is indeed required. Let's try this:
Code: Select all
on sendMail
if the hilite of button "IAgree" then
put empty into myFormData
put libUrlMultipartFormData(myFormData, \
"rcpnt" & ("myemailXaddressXcom"), \
"subj","LoanApp", \
"cu",(the selectedText of button "CUlist"), \
"mn",(field "MembNmbr"), \
"ff",(field "FirstField"), \
"lf",(field "LastField"), \
"tf",(field "teleField"), \
"af",(field "AltField"), \
"ef",(field "EmailField"), \
"if",(field "IncomeField")) \
into myError
if myError is empty then
set the httpHeaders to line 1 of myFormData
post line 2 to -1 of theFormData to URL "http://localhost/My%20directory%20to%20the%20App/file.php"
put the result into rslt
if rslt is empty then
beep
answer information "Submitted successfully"
else
beep
answer rslt
end if
else
beep
answer error "Can't submit data because of error:" && myError
end if
end if
end sendMail
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Any ideas on what my PHP file should look like...
Looks to me like you edited out the header declaration here:
You may therefore have received the email with the fields populated, but they don't appear as part of the message because it hasn't been structured correctly?
TryIf nothing else, it may be that just starting with the quoted literal text "MIME-Version:" etc is making the script fail because it's not an actual php statement, so get rid of the whole bit between $msg and $rslt assignments.
Code: Select all
$msg=$cu.$s.$mn.$s.$ff.$s.$lf.$s.$tf.$s.$af.$s.$ef.$s.$if;
"MIME-Version: 1.0\r\n" .
Try
Code: Select all
$msg=$cu.$s.$mn.$s.$ff.$s.$lf.$s.$tf.$s.$af.$s.$ef.$s.$if;
$header = "MIME-Version: 1.0\r\n" .
"Content-type: text/plain; charset=latin-1\r\n" .
"\r\n";
Re: Any ideas on what my PHP file should look like...
Rae,
The previous poster is right. You need to put the header back into place. You might want to try that before you test my new LC script.
Best,
Mark
The previous poster is right. You need to put the header back into place. You might want to try that before you test my new LC script.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Any ideas on what my PHP file should look like...
Gave these suggestions a try and still have the same results. I wonder if you are onto something with our server though. Maybe it will not accept outside data? We use network solutions. Is there another way, that you know of, of sending out the data via email without the user needing to open their emailing program?
Thanks!
-Rae
Thanks!
-Rae
Re: Any ideas on what my PHP file should look like...
Hi Rae,
Can you post the (anonymised) source text of an e-mail created by the PHP script?
Best,
Mark
Can you post the (anonymised) source text of an e-mail created by the PHP script?
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Any ideas on what my PHP file should look like...
The ~ replaces my specific data.
From - Thu Jul 11 08:59:24 2013
X-Account-Key: account1
X-UIDL: AAAwhgEAAAAqgMDiSST8XWEXKvIQoE6R
X-Mozilla-Status: 0001
X-Mozilla-Status2: 00000000
X-Mozilla-Keys:
Received: from fwd1j.spamh.com ([174.37.170.194]) by server.~.local with Microsoft SMTPSVC(6.0.3790.4675);
Thu, 11 Jul 2013 08:55:50 -0700
Received: from l35.spamh.com (l35.spamh.com [67.225.140.100])
by fwd1j.spamh.com (8.14.2/8.14.2) with ESMTP id r6BFtp0e014789
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
for <~@~.com>; Thu, 11 Jul 2013 11:55:52 -0400
Received: from omr8.networksolutionsemail.com (lbd.spamh.com [75.126.136.141])
by l35.spamh.com (8.14.2/8.14.2) with ESMTP id r6BFtpIa031533
for <~@~.com>; Thu, 11 Jul 2013 11:55:51 -0400
Received: from vux.bos.netsolhost.com ([10.49.33.116])
by omr8.networksolutionsemail.com (8.13.8/8.13. with ESMTP id r6BFtp6B026580
for <~@~.com>; Thu, 11 Jul 2013 11:55:51 -0400
Received: from vux116.mgt.hosting.dc2.netsol.com (localhost [127.0.0.1])
by vux.bos.netsolhost.com (8.14.4/8.14.4) with ESMTP id r6BFtoWB024141
for <~@~.com>; Thu, 11 Jul 2013 11:55:51 -0400
Received: (from 1553069.1672506@localhost)
by vux116.mgt.hosting.dc2.netsol.com (8.14.4/8.14.4/Submit) id r6BFrIeE018831;
Thu, 11 Jul 2013 11:53:18 -0400
Date: Thu, 11 Jul 2013 11:53:18 -0400
From: "1553069.1672506" <~.~@vux.bos.netsolhost.com>
Message-Id: <201307111553.r6BFrIeE018831@vux116.mgt.hosting.dc2.netsol.com>
To: ~@~.com
Subject:
X-SpamH-CheckIP: 205.178.146.58
X-SpamH-ID: l35.spamh.com-r6BFtpIa031533
X-SpamH-NG: 0
Return-Path: ~.~@vux.bos.netsolhost.com
X-OriginalArrivalTime: 11 Jul 2013 15:55:50.0531 (UTC) FILETIME=[1DA6CD30:01CE7E4F]
From - Thu Jul 11 08:59:24 2013
X-Account-Key: account1
X-UIDL: AAAwhgEAAAAqgMDiSST8XWEXKvIQoE6R
X-Mozilla-Status: 0001
X-Mozilla-Status2: 00000000
X-Mozilla-Keys:
Received: from fwd1j.spamh.com ([174.37.170.194]) by server.~.local with Microsoft SMTPSVC(6.0.3790.4675);
Thu, 11 Jul 2013 08:55:50 -0700
Received: from l35.spamh.com (l35.spamh.com [67.225.140.100])
by fwd1j.spamh.com (8.14.2/8.14.2) with ESMTP id r6BFtp0e014789
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
for <~@~.com>; Thu, 11 Jul 2013 11:55:52 -0400
Received: from omr8.networksolutionsemail.com (lbd.spamh.com [75.126.136.141])
by l35.spamh.com (8.14.2/8.14.2) with ESMTP id r6BFtpIa031533
for <~@~.com>; Thu, 11 Jul 2013 11:55:51 -0400
Received: from vux.bos.netsolhost.com ([10.49.33.116])
by omr8.networksolutionsemail.com (8.13.8/8.13. with ESMTP id r6BFtp6B026580
for <~@~.com>; Thu, 11 Jul 2013 11:55:51 -0400
Received: from vux116.mgt.hosting.dc2.netsol.com (localhost [127.0.0.1])
by vux.bos.netsolhost.com (8.14.4/8.14.4) with ESMTP id r6BFtoWB024141
for <~@~.com>; Thu, 11 Jul 2013 11:55:51 -0400
Received: (from 1553069.1672506@localhost)
by vux116.mgt.hosting.dc2.netsol.com (8.14.4/8.14.4/Submit) id r6BFrIeE018831;
Thu, 11 Jul 2013 11:53:18 -0400
Date: Thu, 11 Jul 2013 11:53:18 -0400
From: "1553069.1672506" <~.~@vux.bos.netsolhost.com>
Message-Id: <201307111553.r6BFrIeE018831@vux116.mgt.hosting.dc2.netsol.com>
To: ~@~.com
Subject:
X-SpamH-CheckIP: 205.178.146.58
X-SpamH-ID: l35.spamh.com-r6BFtpIa031533
X-SpamH-NG: 0
Return-Path: ~.~@vux.bos.netsolhost.com
X-OriginalArrivalTime: 11 Jul 2013 15:55:50.0531 (UTC) FILETIME=[1DA6CD30:01CE7E4F]
Re: Any ideas on what my PHP file should look like...
The smilie is 8~~) without the two tildas.
lol
lol
Re: Any ideas on what my PHP file should look like...
Did you change back to as well?
Code: Select all
$rslt = mail($rcpnt,$subj,$msg);
Code: Select all
$rslt = mail($rcpnt,$subj,$msg,$header);
Re: Any ideas on what my PHP file should look like...
I sure did. Thanks for any other suggestions.
Sincerely,
Rae
Sincerely,
Rae
Re: Any ideas on what my PHP file should look like...
Here is what I am currently using:
on sendMail
if the hilite of button "IAgree" then
put "rcpnt=" & urlEncode("~@~.com") & amp & \
"subj=LoanApp" & amp & \
"cu=" & urlEncode(the selectedText of button "CUlist") & amp & \
"mn=" & urlEncode(field "MembNmbr") & amp & \
"ff=" & urlEncode(field "FirstField") & amp & \
"lf=" & urlEncode(field "LastField") & amp & \
"tf=" & urlEncode(field "teleField") & amp & \
"af=" & urlEncode(field "AltField") & amp & \
"ef=" & urlEncode(field "EmailField") & amp & \
"if=" & urlEncode(field "IncomeField") into myParams
post myParams to URL "~://~.~.com/downloads/App/App.php"
if the result is empty then answer "Submited Successfully"
end if
end sendMail
<?php
$rcpnt="~@~.com";
$subj=$_POST["subj"];
$cu=$_POST["cu"];
$mn=$_POST["mn"];
$ff=$_POST["ff"];
$lf=$_POST["lf"];
$tf=$_POST["tf"];
$af=$_POST["af"];
$ef=$_POST["ef"];
$if=$_POST["if"];
$s=" "; //space
$msg=$cu.$s.$mn.$s.$ff.$s.$lf.$s.$tf.$s.$af.$s.$ef.$s.$if;
$header = "MIME-Version: 1.0\r\n" .
"Content-type: text/plain; charset=latin-1\r\n" .
"\r\n";
$rslt = mail($rcpnt,$subj,$msg,$header);
if (!$rslt)
echo 'An error occurred';
else echo 'Mail sent';
?>
on sendMail
if the hilite of button "IAgree" then
put "rcpnt=" & urlEncode("~@~.com") & amp & \
"subj=LoanApp" & amp & \
"cu=" & urlEncode(the selectedText of button "CUlist") & amp & \
"mn=" & urlEncode(field "MembNmbr") & amp & \
"ff=" & urlEncode(field "FirstField") & amp & \
"lf=" & urlEncode(field "LastField") & amp & \
"tf=" & urlEncode(field "teleField") & amp & \
"af=" & urlEncode(field "AltField") & amp & \
"ef=" & urlEncode(field "EmailField") & amp & \
"if=" & urlEncode(field "IncomeField") into myParams
post myParams to URL "~://~.~.com/downloads/App/App.php"
if the result is empty then answer "Submited Successfully"
end if
end sendMail
<?php
$rcpnt="~@~.com";
$subj=$_POST["subj"];
$cu=$_POST["cu"];
$mn=$_POST["mn"];
$ff=$_POST["ff"];
$lf=$_POST["lf"];
$tf=$_POST["tf"];
$af=$_POST["af"];
$ef=$_POST["ef"];
$if=$_POST["if"];
$s=" "; //space
$msg=$cu.$s.$mn.$s.$ff.$s.$lf.$s.$tf.$s.$af.$s.$ef.$s.$if;
$header = "MIME-Version: 1.0\r\n" .
"Content-type: text/plain; charset=latin-1\r\n" .
"\r\n";
$rslt = mail($rcpnt,$subj,$msg,$header);
if (!$rslt)
echo 'An error occurred';
else echo 'Mail sent';
?>