2 of 3
2
Send an email to user-selected recipient using “freeform_module_insert_begin” hook
Posted: 22 April 2009 11:46 PM   [ Ignore ]   [ # 16 ]
Newbie
Rank
Total Posts:  2
Joined  2009-04-16

Great work Ryan.  Thanks. 

Anyone figure out how to apply a template to this email?  I’ve been trudging through the code for a while, but I haven’t been able to figure it out.  The email just sends it all in one big block.

Profile
 
 
Posted: 23 April 2009 10:59 AM   [ Ignore ]   [ # 17 ]
Newbie
Rank
Total Posts:  2
Joined  2009-04-16

Ok.  I figured it out.  The template has already been applied to the message when it is called in the hook.  The mailtype is hardcoded to ‘html’ in ext.md_freeform_send_another.

So just change one parameter:

$email->mailtype 'html'

to

$email->mailtype 'text'

And the email will be formatted correctly.

From this:

Someone has posted to Freeform. Here are the details: Entry Date: 2009-04-22 10:43 PM Name: jack Email: email@no-spam.com Phone: 209-555-0987 Subject: don’t mess with texas Message: Comin’ to getcha.

to this:

Someone has posted to Freeform. Here are the details:

Entry Date: 2009-04-23 09:45 AM
Name: jack
Email: email@no-spam.com
Phone: 209-555-0987
Subject: don’t mess with texas
Message: Comin’ to getcha.

Profile
 
 
Posted: 24 April 2009 08:21 AM   [ Ignore ]   [ # 18 ]
Newbie
Rank
Total Posts:  2
Joined  2008-05-08
Tim Kelty - 16 April 2009 08:51 PM
littlered - 16 April 2009 08:46 PM

thanks mdesign. i looked under the ‘hood, and isn’t having the emails in the drop down vulnerable to spam? (of course, unpublished emails of mine still manage to get spam lol). that’s what i am trying to avoid… i want my cake (the user-select recipient), i want to eat it too (“hidden” email addys). onward, ho!

Yep, here’s what I did. The value for the select options in the markup was just an array key that got the whole email from within my extension:


Hi Tim, you appear to have produced something that will meet a need I have for a clients site but as a newcomer to EE I have no idea what you do with this.  How do you add this to EE?

Neil

Profile
 
 
Posted: 28 April 2009 01:48 AM   [ Ignore ]   [ # 19 ]
Newbie
Rank
Total Posts:  2
Joined  2008-05-08

Hi Can any one help me with this please, I need to have a contact form that the user can choose who they send the email to and this thread appears to have the answer but how do I implement it?

thanks

Neil

Profile
 
 
Posted: 29 April 2009 01:20 AM   [ Ignore ]   [ # 20 ]
Jr. Member
RankRank
Total Posts:  42
Joined  2008-07-08
noddy - 28 April 2009 01:48 AM

Hi Can any one help me with this please, I need to have a contact form that the user can choose who they send the email to and this thread appears to have the answer but how do I implement it?

thanks

Neil

hi me too…

in fact a solution that the user can type in the recipient address. I want to do a postcard service…
any help would really be appriciated!

Profile
 
 
Posted: 29 April 2009 01:32 AM   [ Ignore ]   [ # 21 ]
Jr. Member
RankRank
Total Posts:  42
Joined  2008-07-08

hi ryan,

I’ve just downloaded your “MD freeform send another” extension.
and it says “Send email to a person from a dropdown (or other custom field in your form)”

this would be absolutely fabulous!

could you tell me how to specify the field for the email it get’s send to.

I have the following email field that I want it to be sent to:
From Address

<input type="text" name="ecard_fmail" class="ecard_smaller" /> 

To Address

<input type="text" name="ecard_tmail" class="ecard_smaller" /> 

logically I will specify the {ecard_fmail} in the email template.
so where do I specify the “ecard_tmail” in your extension?
thanks a lot already

stefan

p.s. I don’t know any php! sorry!

Profile
 
 
Posted: 06 May 2009 09:24 AM   [ Ignore ]   [ # 22 ]
Member
Avatar
RankRankRank
Total Posts:  148
Joined  2006-09-11

If you look at the code on GitHub around line 128:

$recipient $query->row['salescontact']

“salescontact” is the short name of my freeform field that holds the extra email.

In your case, I think you only have to install the extension and change that line to:

$recipient $query->row['ecard_tmail']
 Signature 

ryan masuga
—————
Masuga Design (EE Pro) | devot:ee
MD Markitup | All Add-Ons
@masuga | @masugadesign | @devot_ee

Profile
 
 
Posted: 07 May 2009 03:59 AM   [ Ignore ]   [ # 23 ]
Jr. Member
RankRank
Total Posts:  42
Joined  2008-07-08
mdesign - 06 May 2009 09:24 AM

If you look at the code on GitHub around line 128:

$recipient $query->row['salescontact']

“salescontact” is the short name of my freeform field that holds the extra email.

In your case, I think you only have to install the extension and change that line to:

$recipient $query->row['ecard_tmail']

thanks a lot for that hint!!!
this was exactely what I was looking for…
till now, I used ee’s native “tell a friend” form… which worked aswell..
but, beeing able to use “templates” is much nicer!
thanx!
stefan

Profile
 
 
Posted: 15 May 2009 04:00 AM   [ Ignore ]   [ # 24 ]
Jr. Member
RankRank
Total Posts:  42
Joined  2008-07-08

hi ryan ,

I’ve just tried your extension again,
and I did comment out “unset($msg);” in the freeform module 2.7.2. (mod.freeform.php). the second one was already commented out….
I did change the variable to my to email address in your extension: “$recipient = $query->row[‘tmail’];”

then I get an error:

Notice: Undefined variable: msg in /home/schwelle/public_html/backend/modules/freeform/mod.freeform.php on line 1505

Warning: Cannot modify header information - headers already sent by (output started at /home/schwelle/public_html/backend/modules/freeform/mod.freeform.php:1505) in /home/schwelle/public_html/backend/core/core.functions.php on line 296

p.s. line 1505 is the following:    $edata = $EXT->call_extension(‘freeform_module_insert_end’, $fields, $this->entry_id, $msg);

do you know what that could mean?
cheers
stefan

P.S. If I use freeform for other stuff… will it still work after commenting out unset($msg)???

Profile
 
 
Posted: 15 May 2009 07:56 AM   [ Ignore ]   [ # 25 ]
Member
Avatar
RankRankRank
Total Posts:  148
Joined  2006-09-11

There have been a few versions of Freeform to come out since I first did this extension, so I’m not sure if the $msg needs to be unset. I’m thinking you don’t want to unset it now because it looks like that call_extension needs it. I haven’t dealt with this extension in a while, so I might be a little out of the loop - but I’d try uncommenting the unset line to being it back and see if you still get the error.

 Signature 

ryan masuga
—————
Masuga Design (EE Pro) | devot:ee
MD Markitup | All Add-Ons
@masuga | @masugadesign | @devot_ee

Profile
 
 
Posted: 15 May 2009 08:03 AM   [ Ignore ]   [ # 26 ]
Jr. Member
RankRank
Total Posts:  42
Joined  2008-07-08
mdesign - 15 May 2009 07:56 AM

There have been a few versions of Freeform to come out since I first did this extension, so I’m not sure if the $msg needs to be unset. I’m thinking you don’t want to unset it now because it looks like that call_extension needs it. I haven’t dealt with this extension in a while, so I might be a little out of the loop - but I’d try uncommenting the unset line to being it back and see if you still get the error.

I am giving up, since I get errors as soon as I activate your extension… and I am a php noob…
so, I’m back to the tell-a-friend solution, which doesn’t work to bad…

thanks anyways!
stefan

Profile
 
 
Posted: 16 May 2009 11:18 PM   [ Ignore ]   [ # 27 ]
Newbie
Rank
Total Posts:  5
Joined  2008-12-23

Is there any chance you still have a copy of FreeForm 2.6.5 lying around…I also cannot get this to work in 2.7.2, i get the same error as outline4 regarding the $msg variable…?... anyone?

Profile
 
 
Posted: 17 May 2009 11:32 AM   [ Ignore ]   [ # 28 ]
Member
Avatar
RankRankRank
Total Posts:  148
Joined  2006-09-11

Solspace devs, you’re killing us here. Is the $msg variable available to the freeform_module_insert_end hook like your documentation says it is (scroll to bottom), or not? From the docs:

Finally, you can access the message that was emailed to the notification list through the $msg variable.

I don’t think that’s true. It seems my extension that uses this hook is no longer working post 2.6.5. When it WAS working for 2.6.5, I had to hack your module to get it to work. The error everyone is getting is this:

Notice: Undefined variable: msg in /.../devsite.com/system/modules/freeform/mod.freeform.php on line 1505

Does it have anything to do with the newer use of “active_hook”?

You need to update your docs at any rate: I’ve found two more hooks hiding in the module that aren’t listed in the docs: freeform_module_admin_notification and freeform_module_user_notification. If the example there for freeform_module_insert_end needs to be updated for more recent versions of Freeform, could you do that as well, so i know how to “fix” my extension to work with your module?

 Signature 

ryan masuga
—————
Masuga Design (EE Pro) | devot:ee
MD Markitup | All Add-Ons
@masuga | @masugadesign | @devot_ee

Profile
 
 
Posted: 19 May 2009 01:02 PM   [ Ignore ]   [ # 29 ]
Administrator
Avatar
RankRankRankRankRank
Total Posts:  8238
Joined  2006-10-18

Hi Ryan,

Thanks for your patience with us…
We’ll have this fixed up and have the Documentation adjusted shortly smile

 Signature 
Profile
 
 
Posted: 19 May 2009 01:26 PM   [ Ignore ]   [ # 30 ]
Member
Avatar
RankRankRank
Total Posts:  148
Joined  2006-09-11

Sweet, thanks. This has become quite the thread!

 Signature 

ryan masuga
—————
Masuga Design (EE Pro) | devot:ee
MD Markitup | All Add-Ons
@masuga | @masugadesign | @devot_ee

Profile
 
 
   
2 of 3
2