Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
Good Evening Couch.

I know there is default mailer inside couch. But i just wanna know, how can i make php mailer editable.

Code: Select all
<?php
   $to = "your mail"; /*Your Email*/
   $subject = "Your subject"; /*Issue*/
   $date = date ("l, F jS, Y");
   $time = date ("h:i A");    
   $Email=$_REQUEST['Email'];

   $msg="
   Name: $_REQUEST[Name]
   Email: $_REQUEST[Email]
   Phone: $_REQUEST[Phone]   
   
   Message sent from website on date  $date, hour: $time.\n

   Message:
   $_REQUEST[message]";

   if ($Email=="") {
      echo "Please enter your email";
   }
   else{
      mail($to, $subject, $msg, "From: $_REQUEST[Email]");
      echo "Thank you for your message";   
   }
   
?>


Code: Select all
<form id="form" action="php/send_mail.php">
.....................
</form>


i wonder how can i make the "$to = "your mail"; /*Your Email*/" & "$subject = "Your subject"; /*Issue*/" editable like default couch mailer.
As soon as possible!

Touch me up : abada[dot]zulma[at]gmail[dot]com
Hi,

Create editable regions to hold the address and subject.
Suppose the names of the regions are 'my_address' and 'my_subject' and the template they are defined in is 'globals.php' (a non-clonable template).
Following is how we can use the values of the regions in PHP code
Code: Select all
<cms:php>
   $to = "<cms:get_custom_field 'my_address' masterpage='globals.php' />"; /*Your Email*/
   $subject = "<cms:get_custom_field 'my_subject' masterpage='globals.php' />"; /*Issue*/

   ..
   ..
</cms:php>

The important thing to note is that we have replaced "<?php .. ?>" tags with "<cms:php>..</cms:php>" tags to make Couch execute the PHP (and use its variables in the block as above).

Hope this helps.
KK wrote: Hi,

Create editable regions to hold the address and subject.
Suppose the names of the regions are 'my_address' and 'my_subject' and the template they are defined in is 'globals.php' (a non-clonable template).
Following is how we can use the values of the regions in PHP code
Code: Select all
<cms:php>
   $to = "<cms:get_custom_field 'my_address' masterpage='globals.php' />"; /*Your Email*/
   $subject = "<cms:get_custom_field 'my_subject' masterpage='globals.php' />"; /*Issue*/

   ..
   ..
</cms:php>

The important thing to note is that we have replaced "<?php .. ?>" tags with "<cms:php>..</cms:php>" tags to make Couch execute the PHP (and use its variables in the block as above).

Hope this helps.


thx KK. So where to put the php mailer file?

-couch
-css
-js
-img
-mailer
-- mail.php
index.html
contact.html

the mail.php is inside the mailer folder. Do i need to put it inside mailer folder, or i need to put it outside?
As soon as possible!

Touch me up : abada[dot]zulma[at]gmail[dot]com
Out of curiosity, why is it that you have decided not to use Couch's send_mail tag for this?
cheesypoof wrote: Out of curiosity, why is it that you have decided not to use Couch's send_mail tag for this?

yeah i use default couch mailer for all website i make. i just read tutorial about php mailer the night before. just wanna know how couch handle php mailer.
As soon as possible!

Touch me up : abada[dot]zulma[at]gmail[dot]com
5 posts Page 1 of 1
cron