cformsII Support Forum
Current User: Guest *Frequently Asked Questions*
Search 
Search Forums:


 




Re ask - dynamic email

Add a New Topic Reply to Post
Post

gulflee - Guest

4:22 pm - March 15, 2008

1

Please replace the ??? with your data!


[desc]:Is this ask b4? I having many post1,2,3,4,5. and i places a cform in it,

now i want all cform to send to differnet email. what should i do?

or

create many form, form1, form2, form3, formXXX. but this will need to have 200~form and maybe more so not the right way i think.


I m now try to add new author and register a differnet email to all of them. But i m sure there will be better way to do it.

tq_

Oliver - Admin

4:58 pm - March 15, 2008

posts 3921

2

Not sure I follow.

You have N posts and want to display in each the same contact form?

But want the form to be sent to different email addresses?

Where is that recipient email address stored (with each post?)?

gulflee - Guest

5:02 am - March 16, 2008

3

Tq, yes you get it right,

but i m doing is: changing every post to a author and plus+ email.

can it be done in more smarter way?

can i be done by;

getting a $key-value from the post and insert to the form.?

thank for advices

gulflee - Guest

5:11 am - March 16, 2008

4

//I had try this;

$key="email";
$new_to = get_post_meta($post->ID, $key, true);

$sentadmin = @mail($new_to, encode_header($vsubject), $fmessage, $headers);   


//but i canot get the $new_to to print??

the $key and value had add on the single post did not print

Oliver - Admin

10:03 am - March 16, 2008

posts 3921

5

In principle you're right and I think one or two other users have done it this way already.

You have to double check though that $post->ID is set! Also, the above needs to be applied in both Ajax mode (cforms.php) and nonAjax mode (lib_nonajax.php).

In the ajax part you'll find a specific variable that is set to contain the post ID! And this requires the additional form info to be set in the form config! (usually enabled to access title, excerpt post variables)

gulflee - Guest

12:24 pm - March 17, 2008

6

hi  oliver,

i had manage found a post  related to this one but not manage to clear it coz i m using 7.5.2 now some thing is change in cform.php dyanamic email

You have to double check though that $post->ID is set! Also, the above needs to be applied in both Ajax mode (cforms.php) and nonAjax mode (lib_nonajax.php).

 how to check $post_ID is sest. and how check Ajex and nonAjex? tq

Oliver - Admin

7:01 pm - March 17, 2008

posts 3921

7

For your above code snippet: in cforms.php (Ajax control) you need to use

$new_to = get_post_meta($Ajaxpid, $key, true);

while in lib_nonajax.php you can keep:

global $post;

$new_to = get_post_meta($post->ID, $key, true);

gulflee - Guest

3:20 pm - March 18, 2008

8

lib_nonajex.php

else
        global $post;
        $key="email";
        $new_to = get_post_meta($post->ID, $key, true);
        $sentadmin = @mail($new_to, encode_header($vsubject), $fmessage.$attached, $headers);   

cform.php

    // SMTP server or native PHP mail() ?
    if ( $smtpsettings[0]=='1' )
        $sentadmin = cforms_phpmailer( $no, $frommail, $field_email, $to, $vsubject, $message, $formdata, $htmlmessage, $htmlformdata );
    else

        $key="email";
        $new_to = get_post_meta($Ajaxpid, $key, true);

        $sentadmin = @mail($new_to, encode_header($vsubject), $fmessage, $headers);    

is this the right way ?

Admin get the cc mail, but form Email add= {Email} did not recive the form mail
is it the $key=email did not run or get?

Oliver - Admin

6:46 pm - March 18, 2008

posts 3921

9

It looks good to me, not sure why it's not working. Perhaps you can add the $new_to variable to the $vsubject to see if it is set correctly.

gulflee - Guest

4:11 am - March 20, 2008

10

hi this really great. is done with the method above. tq so much

Reply to Post


Reply to Topic: Re ask - dynamic email
PLEASE READ THE FAQs FIRST! THANK YOU.

NOTE: New Posts are subject to administrator approval before being displayed

Guest Name (Required):

Guest EMail (Required):

Topic Reply:

Save New PostSmileysOptions

Guest URL (required)

Math Required!
What is the sum of:
3 + 2
   

 
Confused Cool Cry Embarassed Frown Kiss Laugh Smile Surprised Wink Yell

Search