Two mailforms?

General questions about CMSimple
Tata
Posts: 3313
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: Two mailforms?

Post by Tata » Tue Oct 05, 2010 6:18 am

Well, that's right. It is the way how this function works - checking if an adress is given. Then try how it works, if you define any (dummy) email in config and then change it via hi_pd_scripting. This might work. CMSimple then checks if an emal is defined and will load the function "mailform". Loading the particular page it should read the changed $cf from pagedata and theoretically should change the original $cf value. Sory, I just don't have enough time to test it right now.
The logic says (in cms.php):

Code: Select all

if ($f == 'mailform' && $cf['mailform']['email'] != '')include($pth['file']['mailform']);
If function mailform is called && variable email is not empty, return mailform.
Then (with a dummy@email.com defined in config.php) and:
For the page Send to Webmaster

Code: Select all

$cf['mailform']['email']="webmaster@email.com";

Code: Select all

<h1>Send to Webmaster</h1>
<p>#CMSimple include $pth['file']['mailform']; $o = $output . $o; $output = '';#</p>
Should send an email to webmaster.

For the page Send to Somebody

Code: Select all

$cf['mailform']['email']="somebody@email.com";

Code: Select all

<h1>Send to Somebody</h1>
<p>#CMSimple include $pth['file']['mailform']; $o = $output . $o; $output = '';#</p>
Should send an email to Somebody.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

bca
Posts: 293
Joined: Tue Sep 15, 2009 4:49 pm

Re: Two mailforms?

Post by bca » Tue Oct 05, 2010 7:43 pm

Hi Tata
Thanks for that. I undertstand how the function works and the theory of what you are trying to do but it still wont work! The email always goes to the address in config.php
I wonder whether its doing it in the wrong order so the email address in the config always get priority or overwrites what you put in pd scripting.

b

Tata
Posts: 3313
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: Two mailforms?

Post by Tata » Tue Oct 05, 2010 9:14 pm

I am sorry, but right these days I really have no time to test this. But maybe you should try some external mailing script and put it in with wrapper plugin or using hi_pd_scripting calling its index.php file directly. Maybe next week I find some time to loook at this.
EDIT
You dropped the worm in my head. I tested just as recommended above. It works for me. However, there is some problem with positioning on the page. Also, you can't get the email link in your template (because of missing email in config.php). I tested it only on my localhost putting the $cf variable in hi_pd_scripting and putting the script directly under the heading (without hi_pd_scripting). So I am not sure if it would send the email. But the email form shows up on the page.
I will try to find some time to test it online as well. But not now.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

bca
Posts: 293
Joined: Tue Sep 15, 2009 4:49 pm

Re: Two mailforms?

Post by bca » Wed Oct 06, 2010 11:22 am

Hi Tata
Thanks for your efforts. I was thinking along the same lines ie having an external script.

Using your code i also got the email form on the page but the actual sent email only goes to email address in config.

I am sure it must be possible...

B

Till
Posts: 337
Joined: Tue May 20, 2008 7:20 am
Location: Germany: Bremen
Contact:

Re: Two mailforms?

Post by Till » Fri Oct 22, 2010 3:19 pm

Shouldn`t it work with the plugin asform (http://cmsimplewiki.com/doku.php/plugin ... ers/asform)? Here you can define as many recipients as you want. And you should be able to place it at any page.

Till

bca
Posts: 293
Joined: Tue Sep 15, 2009 4:49 pm

Re: Two mailforms?

Post by bca » Sat Oct 23, 2010 9:50 pm

Hi Till

Thanks for that. On the face of it it seems like it is exactly what i am looking for but after about 3 hours testing I cannot get it to send an email!

I am using #CMSimple $output .= asform("","mail1@address.com");# (with the dot!)

I get the thank you message but dont actually get the email.

I am using XH. Does it work with XH?

B

Till
Posts: 337
Joined: Tue May 20, 2008 7:20 am
Location: Germany: Bremen
Contact:

Re: Two mailforms?

Post by Till » Sun Oct 24, 2010 12:00 pm

bca wrote:I am using XH. Does it work with XH?
Hi bca,

I am not sure. It should work with XH. But I will test it. But unfortunately I am gone for the week and will be back on Saturday. In the moment I can do stuff like that obly during weekends.

Till

bca
Posts: 293
Joined: Tue Sep 15, 2009 4:49 pm

Re: Two mailforms?

Post by bca » Sun Oct 24, 2010 6:40 pm

Thanks Till.
I'll look forward to it

B

bca
Posts: 293
Joined: Tue Sep 15, 2009 4:49 pm

Re: Two mailforms?

Post by bca » Sun Oct 24, 2010 7:24 pm

ah ah
Have done some more testing and it does work OK with XH.
It didnt work because it didn't like my "xxx@btconnect.com" email address. I expect it is BTs fault
Used another address and it is OK.
Thanks for pointing me in this direction.

B

BT is UK telecom supplier ;-)

Till
Posts: 337
Joined: Tue May 20, 2008 7:20 am
Location: Germany: Bremen
Contact:

Re: Two mailforms?

Post by Till » Wed Oct 27, 2010 10:11 am

bca wrote:ah ah
Have done some more testing and it does work OK with XH
Thanks for testing.

Till

Post Reply