Forums

Auto Responder

artistjewel 02 Nov, 2007
Is it posible to set one of these up?

So when a form is submitted they get an email sent back immediately? And if so, can it be customized so that from a certain selection within a field different emails can be auto-sent?
Max_admin 02 Nov, 2007
Sure, use this line of code at the onsubmit box to get an email sent :


<?php

mosMail($from, $fromname, $recipient, $subject, $html_message, true,$ccemails, $bccemails, $attachments, $replyto_email, $replyto_name );
?>



now config all values to your needs🙂
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
artistjewel 03 Nov, 2007
Could you please explain what each value is?

Also, can the email that is sent be one I've customized in html?
GreyHead 03 Nov, 2007
Hi artistjewel,

Please tell us more about what you want to do. Some things can be done very simply with ChronoForms, others need custom code written.

ChronoForms usually sends one email when a form is completed. You can have that email sent to several people (including the person who completed the form). You can also have it use your custom html using a template. You can use PHP in the template filed to change the email depending on the contents of the form.

If you want to send more than one e-mail then you use the code Max suggested to create a second one. Here's one example of how you might use it:
<?php
$from = $replyto_email ="artistjewel@example.com";
$fromname = $replyto_name = "artistjewel";
$recipient = $_POST['email'];
$subject = "email from artistjewel";
$html_message = "<p>Hi, Here's a message from artistjewel.</p>";
$ccemails = $bccemails = $attachments = "";

mosMail($from, $fromname, $recipient, $subject, $html_message, true, $ccemails, $bccemails, $attachments, $replyto_email, $replyto_name );
?>


Bob
artistjewel 03 Nov, 2007
My form is for clients enquiring about airfares, we have two areas 'Australia' and 'New Zealand' that we wish to have an auto response email sent back to them. We were hoping to use just the one form and if they selected Australia then the Australia auto response email would be sent, same applies with New Zealand.

Sounds like it might be better to setup separate forms for each of these?
GreyHead 03 Nov, 2007
Hi artistjewel,

If there are just two options then you could easily set up an email template using some php:
<?php
if ( $_POST['country'] == "Australia" ) {
. . . send this email . . .
} else {
. . . send this email . . .
}
?>
Bob<br><br>Post edited by: GreyHead, at: 2007/11/03 00:14
artistjewel 14 Nov, 2007
And where would I insert the email?

Also, if I had them select which region they are from could I have the form results emailed to a different email for each region?

I want 2 regions going to 1 email address and the rest going to another email address.
GreyHead 14 Nov, 2007
Hi artistjewel,

You need to put together the two pieces of code in this thread to do what you want. Something like this:
<?php
if ( $_POST['country'] == "Australia" || "NZ"«») {
  $from = $replyto_email ="artistjewel@example.com";
  $fromname = $replyto_name = "artistjewel";
  $recipient = $_POST['email'];
  $subject = "email from artistjewel";
  $html_message = "<p>Hi, Here's a message from artistjewel.</p>";
  $ccemails = $bccemails = $attachments = "";
} else {
  $from = $replyto_email ="artistjewel@example.com";
  $fromname = $replyto_name = "artistjewel";
  $recipient = $_POST['email'];
  $subject = "different email from artistjewel";
  $html_message = "<p>Hi, Here's a different message from artistjewel.</p>";
  $ccemails = $bccemails = $attachments = "";
}
mosMail($from, $fromname, $recipient, $subject, $html_message, true, $ccemails, $bccemails, $attachments, $replyto_email, $replyto_name );
?>
Exactly what the code would look like depends on exactly what you want to do.

Happy to help you with how to use ChronoForms in your application but if you want specific code written then probably best to post in the Professional Help forum.

Bob
weeteringh 25 Dec, 2007
Thanks for this, but I only receive emails in my admin mailbox. The sender doesn't receive anything. What have I to change so that sender will receive an autoreply.

For example

admin = [email]admin@mysite.com[/email]
sender = [email]name@sender.com[/email]
GreyHead 26 Dec, 2007
Hi weeteringh,

If you want to send the 'same' email to the sender than you can add the 'sender' field name in the Special Fields tab.

If you want to sent two different emails this isn't supported by ChronoForms 'out of the box' but you can do it by using a little php to construct your thank-you email in the 'OnSubmit after email' field. You'll find several recent examples in the forums here.

Bob
weeteringh 28 Dec, 2007
Thanks for your reply

I've had a look (few hours) in all kind of forms but cannot find my solution.

What I want is that sender receives an autoreply with a short message, followed by all data that he/she has subscribed.

I've used your test_form

and put this code in 'after submit':

<?php
$from = $replyto_email ="info@myaccount.com";
$fromname = $replyto_name = "myaccount";
$recipient = $_POST['email'];
$subject = "email from myaccount";

$html_message = "<p>We have receveived your subscription with the following data:</p>";

$name = $_POST['name'];
$email = $_POST['email'];

mosMail($from, $fromname, $recipient, $subject, $html_message, true, $email, $name, $ccemails, $bccemails, $attachments, $replyto_email, $replyto_name );
?>

This scripts results in an email with ALL subscribed data to de the mailbox of owner ([email]info@myaccount.com[/email])

but.............

sender/subscriber receives an email (yes, this works), but only with the message:

We have receveived your subscription with the following data:</

My question: How should I change the script above sho that sender/subscriber also receives his/her other data (name and email in this case).

Thanks again for your help and advice.
Max_admin 28 Dec, 2007
Hi weeteringh,

I understand, we will edit 2 lines of the code so they are like this :

echo "name = ".$_POST['name'];

echo "email = ".$_POST['email'];


and that will do it!!🙂

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
weeteringh 28 Dec, 2007
No Sorry. Same (wrong) result.
You are sure that the html_message string is OK?

Weeteringh<br><br>Post edited by: weeteringh, at: 2007/12/28 11:33
Max_admin 28 Dec, 2007
Oooh, sorry, I thought this to go at the template field, it should be like this :


$html_message = "<p>We have receveived your subscription with the following data:</p>";

$html_message .= "name = ".$_POST['name'];

$html_message .= "email = ".$_POST['email'];


Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
weeteringh 28 Dec, 2007
Almost Max!

This is the result now (I've uses 'MAX' as name and [email]max@myaccount.com[/email] as email address)



We have receveived your subscription with the following data:

name = MAXemail = [email]max@myaccount.nl[/email]




Final question: How can I get email = on a new line

(<br /> and /n won't work)

Rgrds

Weeteringh
weeteringh 29 Dec, 2007
Dear all,

I've found the solution (in another forum):

$html_message = "<p>We have receveived your subscription with the following data:</p>";
$html_message .= "name = ".$_POST['name'].'<br />';
$html_message .= "email = ".$_POST['email'].'<br />';


So: '<br />' at the end of each value.

Thanks anyway!

Happy Seasons's greetings from Holland,

Weeteringh

Post edited by: weeteringh, at: 2007/12/28 19:26<br><br>Post edited by: weeteringh, at: 2007/12/28 19:27
GreyHead 30 Dec, 2007
Hi weetering,

Yes, you can use '<br />' tags like this or put <p> </p> tags around the entries to make separate paragraphs. Just the same as normal html.

Bob
malloy0 18 Aug, 2008
Hi,

At one point I wa able to use the forums to figure out how to get an auto response email to be sent to the $recepient, but for some reason after upgrading from one older version of CF to newer version is stopped working. After spending nearly 20 hours messing with, yes no joke, it's true my wife is ready to kill me and NO successful fix, so see below and hopefully y'all can help.

So, this is the basic code I have in the On Submit code - after sending email:

------------------------------------------------------------------------------------------------------------------------
<?php
$recipient = $_POST['eMail'];
$subject = "CCVC -Season Survey THANK YOU";
$html_message = "<p> ",</p>;
<p>Thank you for completing the Season Survey.</p>
<p></p>
<p>We look forward to seeing you again in the next season. Stay tuned to the website for the latest and most up-to-date information.</p>
<p></p>
<p>Sincerely,</p>
<br>Capital City Volleyball Club</br>
<br>www.myccvc.com</br>
<br>myccvc@yahoo.com</br>
</p>";
mosMail($from, $fromname, $recipient, $subject, $html_message, true );
?>

------------------------------------------------------------------------------------------------------------------------

I get no email send to the $recipent, but with debug ON I got this error:

------------------------------------------------------------------------------------------------------------------------

_POST: Array ( [eMail] => [email]mike_malloy@cree.com[/email] [Comments] => bpllkepkl )
Case 1: Use table layout
E-mail: 'Yes' custom
Email sent
E-mail message
From: CCVC Season Survey [myccvc.website@yahoo.com]
To: [email]mike_malloy@cree.com[/email]
Subject: CCVC Season Survey -RESPONSE SUBMITTED

eMail [email]mike_malloy@cree.com[/email]
Comments bpllkepkl

Submitted by 24.136.241.129

Parse error: parse error, unexpected ',' in /home/content/c/c/v/ccvchosting/html/components/com_chronocontact/chronocontact.php(537) : eval()'d code on line 4

------------------------------------------------------------------------------------------------------------------------

HELP???

Thanks,

Mike
[email]malloy0@msn.com[/email]
GreyHead 18 Aug, 2008
Hi malloy0,

In line 4 of your email template you have
$html_message = "<p> ",</p>;
which makes no sense. The entire html message needs to be between ". . ." so this line should be something like
$html_message = "<p> ,</p>;
or perhaps you want a name in there.

Bob
This topic is locked and no more replies can be posted.