Forums

Unable to Sent A Thankyou Email to Sender.

newseed 17 Aug, 2007
I tried one of the php script to send a thankyou email to the sender but the email never reach it or much if even sent at all.

The php script I use came from this forum:

 <?php
$recipient = $_POST[$paramsvalues->emailfield];
$html_message = "<p>Hi,</p><p>Thank you for filling out our customer survey.</p><p> If you have any question or other comments, please let us know.</p><p>Nikhil<br />General Manager</p><p>DMC Car Care</p>";
$subject = $subject;
mosMail($from, $fromname, $recipient, $subject, $html_message, true, NULL, NULL, NULL, NULL, NULL );
?>


I placed this script in the 'OnSubmit - after sending email' box.

I am sure that I am missing something.
Max_admin 17 Aug, 2007
Hi,

I guess this code was for a slightly different issue but very close, you will need to edit the first line of the code to be :

$recipient = $_POST['field_name_where_user_put_his_email'];


Regards,

max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
newseed 17 Aug, 2007
Again, I must be missing something. I tried this two different ways as follows:

First:

<?php
$recipient = $_POST['field_name_where_user_put_his_email'];
$html_message = "<p>Hi,</p><p>Thank you for filling out our customer survey.</p><p> If you have any question or 
other comments, please let us know.</p><p>Nikhil<br />General Manager</p><p>DMC Car Care</p>";
$subject = $subject;
mosMail($from, $fromname, $recipient, $subject, $html_message, true, NULL, NULL, NULL, NULL, NULL );
?>


I then scratch my head and tried this:

<?php
$recipient = $_POST['Email'];
$html_message = "<p>Hi,</p><p>Thank you for filling out our customer survey.</p><p> If you have any question or 
other comments, please let us know.</p><p>Nikhil<br />General Manager</p><p>DMC Car Care</p>";
$subject = $subject;
mosMail($from, $fromname, $recipient, $subject, $html_message, true, NULL, NULL, NULL, NULL, NULL );
?>


Email is the correct field name I have.

Smack me around a bit and shed some light on what I am doing wrong.

Thanks.
Max_admin 17 Aug, 2007
Hi,

Your 2nd piece of code should work ok, are you sure that the email field name is "Email" ? names are case sensitive!!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
newseed 17 Aug, 2007
I removed the php from the OnSubmit - after email is sent

and put it in

OnSubmit - before email is sent

Now it works. I get the thank you email going to the client's email but now I cannot receive the results of the form to my site's email. Instead, it sends an thank you email to me.

I am becoming more confused as to why I can't just simply set this up.

Here's the form:

<p class="componentheading">Customer Survey Form</p>
<p><span class="red">*</span>Name:<br /> <input type="text" name="Name" value=''></p> 
<p><span class="red">*</span>Company:<br /> <input type="text" name="Company" value=""></p>
<p><span class="red">*</span>Email:<br /> <input type="text" name="client-email" value=""></p>
<p><span class="red">*</span>Phone:<br /> <input type="text" name="Phone" value=""></p>

<p>
<input type="submit" name="submit" value="Submit" class="subres1"> 
<input type="reset" name="Reset" value="Clear Form" class="subres2">
<input type="hidden" name="config" value="0">
</p>


Please note that I am now using 'client-email' as a field name for the email.

The php script which is located in the OnSubmit - before email is sent:

<?php
$recipient = $_POST['client-email'];
$html_message = "<p>Hi,</p><p>Thank you for filling out our customer survey.</p><p> If you have any question or 
other comments, please let us know.</p><p>Nikhil<br />General Manager</p><p>DMC Car Care</p>";
$subject = $subject;
mosMail($from, $fromname, $recipient, $subject, $html_message, true, NULL, NULL, NULL, NULL, NULL );
?>


Now, I am using 2.2.3. Maybe you can verify what it is I am suppose to have in the General tab and Special tab (I have nothing in the Special tab)?

Are you ready to shoot me? :dry:
GreyHead 17 Aug, 2007
Hi newseed,

Let's be clear what you are trying to do - as I understand it. You want to send a normal 'results' e-mail to yourself; then to send a completely different 'thank you' e-mail to the person who submitted the form.

To do this you want the 'Thank you' e-mail created after the 'results' e-mail, if not then the results message is replaced with the 'thank you' message which is what seems to be happening.

Step by step:[list=1]
  • Remove the 'thank you' code from both the before and after fields
  • Check that the results e-mail is working OK
  • Put the 'thank you' code back in the OnSubmit - after field (the code you have below looks good to me)
  • Check that now both e-mails are being sent to the correct addresses
  • [/list:o]Hopefully that should do it. If not please copy the results e-mails here.

    Bob

    PS If you nave v2.3 then turning debug on should show you the 'results email' in your browser.
    newseed 17 Aug, 2007
    I put the php code in the OnSubmit - after field and turned on the Debug mode and here's what I get.

    I now get NO EMAILS to either party.

    Here's the debug report:

    _POST: Array ( [Name] => bob [Company] => you [client-email] => 'client-email removed [Phone] => xxx-xxx-xxxx [submit] => Submit [config] => 0 )
    Case 1: Use table layout
    E-mail: 'Yes' custom

    E-mail message
    From: DMC Car Care [admin@admin.com]
    To: email send to removed,
    Subject: Customer Survey

    Name bob
    Company you
    client-email client-email removed
    Phone xxx-xxx-xxxx


    :pinch:
    GreyHead 17 Aug, 2007
    Hi Newseed,

    Hmmm . . . assuming that the e-mails that you deleted were good that all looks fine. The debug report is exactly what is sent to the Joomla mailer and is printed out right after the mailer executes. It doesn't do anything to stop e-mails being sent.

    Did you put in [email]'admin@admin.com[/email]' I seem to remember that that is a default somewhere in php.ini - my guess is that that is being rejected either by the Joomla Mailer or possibly by your ISP as an invalid domain???

    Bob
    newseed 17 Aug, 2007
    I get the client email just fine. I even removed the php script and tried again and now I can't even get the results to my email that I know works and has worked before I started messing with the php script.

    I welcome you to check the adminstrator back-end to varify all my settings as well as access to the email account I am using.

    If so, let me know how you want me to send the login information.

    P.S, I have used FormM@iler (php script) for html web sites before and never had any problem with it so this is why I am baffled as to why it's not working consistantly.
    GreyHead 17 Aug, 2007
    Hi newseed,

    Sure one of us can have a look, you can send logon info to me at 'info at greyhead.net' or to Max with the contact form here.

    Bob
    Max_admin 17 Aug, 2007
    Newseed,

    Could you please make the from name just "admin", and put some email address which is completely never used at your site or this domain, sometimes it wont send to your admin email or an email under the same domain, this happens at some circumstances !!

    assure you don't have anything under "special fields"!!

    let us know🙂
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    newseed 17 Aug, 2007
    I sent the logon info to you Bob.
    newseed 17 Aug, 2007

    Newseed,

    Could you please make the from name just "admin", and put some email address which is completely never used at your site or this domain, sometimes it wont send to your admin email or an email under the same domain, this happens at some circumstances !!

    assure you don't have anything under "special fields"!!

    let us know🙂



    When I first got the email to send to my email account, it had no trouble with the use of [email]admin@admin.com[/email]. Of course this was before I even started to use the php script.

    After using the php script, I could not get it sent to the client. And the when I did finally get it to work, then the email result did not come to me.

    There's a second-grade school book out there somewhere that I know has the answer to my issue. The problem is, I'm a high-school grad that can't seem to read second-grade school books anymore.face-meh-blank
    newseed 18 Aug, 2007
    After much dilemma on my part, you were helpful in resolving my issues or at least led me in the right direction. I cannot begin to tell you what I did to finally to get it to work.

    I don't think it was ever a problem with ChronoForm but instead it was a faulty person...meaning me!

    Thanks for you time and effort.

    Eddie<br><br>Post edited by: newseed, at: 2007/08/18 19:28
    shayzalman 10 Mar, 2009
    Hi
    I keep on trying sending the "thank you" mail to sender, according to the script that is provided here, but nothing is being sent !!
    I get no errors and the form is being sent OK
    I'm using Joomla 1.012 and CF 2.3.9.

    some how, any attempt to use mosMail is failing to send mail..

    Please, if you have any clue what could it be 🤔
    Max_admin 11 Mar, 2009
    Hi shayzalman,

    does your form send emails before doing this ? I mean to you the admin ?

    show me the code you used in the onsubmit and your HTML email field code as well!!

    Max
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    This topic is locked and no more replies can be posted.