joejac
Posts: 242
|
| Posted: 03/12/2010, 10:53 AM |
|
Hello,
I have a form with about 50 fields, and I would like to send those fields in an email as a confirmation that they were stored, in the after insert event.
I added to the after insert event a Send Email action, but when I get to "Message Body" it requires "Name of the control wich will provide the emails' body" Unfortunately I need to include all the fields with their captions not just one field.
1.- Can somebody show me if it there exists an easy way to include all my fields in the "Message Body"
1.1 If this requires some code, I appreciate a lot the example code in PHP.
Thanks and Best regards
joejac
|
 |
 |
damian
Posts: 838
|
| Posted: 03/12/2010, 11:11 PM |
|
joejac
i create another page with all the values on it and i then implode that page and send it in an after insert event...
if you need specific info let me know and i will find some examples and post them
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
joejac
Posts: 242
|
| Posted: 03/13/2010, 10:47 AM |
|
Thanks a lot Damian,
I already created the second page with a form with all the values but I do not know how to do it, I appreciate a lot a detailed example.
Thanks for your kind help
Best regards
joejac
|
 |
 |
melvyn
Posts: 333
|
| Posted: 03/14/2010, 12:07 PM |
|
Since you build a form and POST that form to a script which reads the values and send them by mail, you can try this:
foreach ($_POST as $tag => $value){
$$tag = set_tag("<br/> $tag : ",$value);
$body .= $tag;
}
I used the above to read a form with ~400 fields this week.
Each CCS form is posted (normally to itself) and the above code must work.
-----
Another approach:
Since the form itself is an object which you can (also) call as $Container from any event, the above code can be modified to call by the content itself instead modify the above to work with $Container calling each variable in the loop.
----
The implode method which damian reffers:
$content = implode("",file("http://joejackserver.com/app/theinfo.php?id=17"));
The above will read the content of http://joejackserver.com/app/theinfo.php?id=17 and store it in a variable named $content which you can use.
_________________
Melvyn Perez
Puro Codigo
http://purocodigo.com |
 |
 |
joejac
Posts: 242
|
| Posted: 03/17/2010, 10:39 AM |
|
Thanks a lot Damian and Melvyn,
Very nice advice and code.
Best regards
joejac
|
 |
 |
joejac
Posts: 242
|
| Posted: 04/01/2010, 12:17 PM |
|
Hello Melvyn,
I was trying to use your solution since it is very short and I like it, but I am not very much familiar with variables variables and I do not know how to set function set_tag() with my form fields "$Component".
1.- Can you please explain in detail all this, so I can adapt to my email Action of the form?
Thanks a lot for your help
Best regards
joejac
Quote melvyn:
foreach ($_POST as $tag => $value){
$$tag = set_tag("<br/> $tag : ",$value);
$body .= $tag;
}
-----
Another approach:
Since the form itself is an object which you can (also) call as $Container from any event, the above code can be modified to call by the content itself instead modify the above to work with $Container calling each variable in the loop.
|
 |
 |
Waspman
Posts: 948
|
| Posted: 04/03/2010, 7:04 AM |
|
I can't remember how I did it, but I have captured the page and embedded in an email before. The benefit is that it keeps the layout of the page so if you want to present the data in tabular format this is ideal. If I could just remember how I did it
_________________
http://www.waspmedia.co.uk |
 |
 |
Waspman
Posts: 948
|
| Posted: 04/03/2010, 7:12 AM |
|
or you can simply build the body as a variable...
global $emailBody;
$emailBody = "";
$emailBody = $emailBody."Hi ".$RecipientName."</b><br><br>";
$emailBody = $emailBody."You have a new message:<br><br>";
$emailBody = $emailBody."Type of contact: ".$ContactType."<br><br>";
$emailBody = $emailBody."Customer/Employer: ".$Customer."<br><br>";
$emailBody = $emailBody."Spoke with: ".$Container->SpokeWith->GetValue()."<br><br>";
$emailBody = $emailBody."Message title: ".$Container->Desc->GetValue()."<br><br>";
$emailBody = $emailBody."Message: ".$Container->Comments->GetValue()."<br><br>";
$emailBody = $emailBody."Call back date: ".CCFormatDate($CBdate1,array("dd","-","mm","-","yyyy"))."<br><br><br>";
$emailBody = $emailBody."<a href=".$Site.">Click here to go to C2T...</a><br><br><br><br>";
$to = $Recipient;
$subject = "YOU HAVE A NEW MESSAGE - C2T ";
$message = $emailBody;
$from = $SenderEmail;
$charset = "Windows-1252";
$transferEncoding = "";
$additional_headers = "From: $from\nReply-To: $from\nContent-Type: text/html; charset=$charset\nContent-Transfer-Encoding: $transferEncoding";
mail ($to, $subject, $message, $additional_headers);
_________________
http://www.waspmedia.co.uk |
 |
 |
damian
Posts: 838
|
| Posted: 04/04/2010, 4:05 AM |
|
i usually send emails using an after insert or after update event....
//Custom Code @61-2A29BDB7
// -------------------------
// Send Email.
// Send Email to Auditor
ini_set("SMTP", "localhost");
//Get HTML content from file
$to = "Recipient <recipient@address>";
$content = "http://www.ysoftware.com/emailStatus.php";
$message = implode("", file($content));
//Prepare Mail
$subject = "Email Subject";
$from = "Webmaster <webmaster@ysoftware.com>";
$additional_headers = "From: $from\nReply-To: $from\nContent-Type: text/html";
//Send Mail
// mail ($to, $subject, $message, $additional_headers,"-f webmaster@ysoftware.com");
ini_restore("SMTP");
// -------------------------
//End Custom Code
things to note...
the link to the page you implode must be fully qualified
the page that you are sending should have a fully qualified link to the style sheet and any images otherwise they wont show...
you can use variables for the email addresses and subjects...
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
|