[SOLVED] Send Email via PHP + built-in method

Post any questions you may have here

[SOLVED] Send Email via PHP + built-in method

Postby moontear on Tue Feb 19, 2008 4:23 pm

Hello there,

I've seen several posts of people who use customized PHP code to send an e-mail, but I seem not to be able to find it anymore.

I use the built in "e-mail results" function to send me a status message with the field-names etc. I don't want users who register to receive that message and hence want to have a custom PHP mail sent to them. This will have a nicer layout and a thank you message etc.

All I need to know is how does a very simple e-mail in PHP+Joomla+Chronoforms look like and how do I call the chronoform field names (e.g. last_name, first_name).
The best would be if somebody would be able to produce the code for "Hello {first_name} {last_name}, thank you for registering".

Thx in advance,
dennis<br><br>Post edited by: moontear, at: 2008/02/19 18:37
moontear
Junior Boarder
 
Posts: 25
Joined: Sat Jan 05, 2008 3:31 pm

Re:Send Email via PHP + built-in method

Postby GreyHead on Tue Feb 19, 2008 5:07 pm

Hi Dennis,

This request seems to be increasing so maybe Max will add it in to a future release. At the moment you have to do a workaround in the 'OnSubmit after email' box. Here's one that I did for a client this week:
Code: Select all
<?php
$recipient = $_POST['email'];
$subject = "Medway Voice - thanks";
$html_message = "<p>Dear ".$_POST['name'].",</p>
<p>Thank you for submitting the membership form.<br />As soon as we process it you will receive your user name and password.</p>
<p>The XXX Team</p>";
mosMail($from, $fromname, $recipient, $subject, $html_message, true );
echo $html_message;
?>
This version sends an email and - in the last 'echo' line also shows it on the ThankYou page.

If you want to add field values then these can be put into the $html_message using the ".$_POST['field_name']." format.

Bob<br><br>Post edited by: GreyHead, at: 2008/02/19 12:08
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3359
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:Send Email via PHP + built-in method

Postby moontear on Tue Feb 19, 2008 11:37 pm

Thank you Bob, helpful as always!
moontear
Junior Boarder
 
Posts: 25
Joined: Sat Jan 05, 2008 3:31 pm

Re:Send Email via PHP + built-in method

Postby Paiyili on Sat Apr 19, 2008 1:53 am

GreyHead wrote:If you want to add field values then these can be put into the $html_message using the ".$_POST['field_name']." format.

Bob<br><br>Post edited by: GreyHead, at: 2008/02/19 12:08


Hi. Could you show me an example of this being done? Thanks.
Paiyili
Fresh Boarder
 
Posts: 1
Joined: Thu Apr 03, 2008 10:06 pm

Re:[SOLVED] Send Email via PHP + built-in method

Postby moontear on Sat Apr 19, 2008 4:49 am

sure will do, following the previous example:

Code: Select all
<?php

$recipient = $_POST['email'];

$subject = "Our Newsletter - thanks";

$html_message = "<p>Dear ".$_POST['name'].",</p>

<p>Thank you for submitting the membership form.<br />As soon as we process it you will receive
your user name and password.</p>

<p>Your username is:".$_POST['username_field']."</p>
<p>Your password is:".$_POST['password_field']."</p>

<p>The XXX Team</p>";

mosMail($from, $fromname, $recipient, $subject, $html_message, true );

echo $html_message;

?>


The line "
<p>Your password is:".$_POST['username_field']."</p>" does output the value of the field with the name "username_field". Just play around with it and your own field names / table column names.

moon

Post edited by: moontear, at: 2008/04/19 00:50<br><br>Post edited by: GreyHead, at: 2008/04/19 01:52
moontear
Junior Boarder
 
Posts: 25
Joined: Sat Jan 05, 2008 3:31 pm


Return to ChronoForms Questions & Answers

Who is online

Users browsing this forum: Google [Bot], MSNbot Media, Yahoo [Bot] and 8 guests