Page 1 of 1
CMSmailer usage
Posted: Wed May 24, 2006 9:01 am
by chipus
hi calguy,
i am using CMSmailer 1.73.9. I failed to find documentation for the module. Could u tell me how to use it.
Code: Select all
$cmsmailer = $this->GetModuleInstance('CMSMailer');
$cmsmailer->AddAddress('calguy1000@hotmail.com','calguy');
$cmsmailer->SetBody('<h1>This is a test message<h1>');
$cmsmailer->IsHTML(true);
$cmsmailer->SetSubject('Test message');
$cmsmailer->Send();
I understand the sample code. However, what should i do if i want to use it this way:
- I create a contact form, which is content many fields. How could i add them into the body of the email, like: name, address, fone....
- I want to add the content body for my email, what should i do?
Hope to hear from you soon.
Regards,
chipus.
Re: CMSmailer usage
Posted: Wed May 24, 2006 1:05 pm
by calguy1000
Well, the body of the message is just a string, so you can put whatever information you want in to that string and then just call
$cmsmailer->SetBody( $body ); // assuming $body is the string that holds it
I personally use smarty templates to build up most of my mail messages.
Putting the results of your form into the body is no issue, you just have to get access to those variables and append them to the body string.
i.e.:
$body = '';
$body .= 'Name: '.$_POST['name'].'';
$body .= 'Address: '.$_POST['address'].'';
$cmsmailer->SetBody( $body );
Hope this helps
Re: CMSmailer usage
Posted: Wed May 24, 2006 1:16 pm
by Dr.CSS
it is used for internally generated email ie. when you have something on your website say a form, someone fills out the form and hits submit button, all the fields/questions/textboxes and answers/input are emailed to the add. of your choosing, you have to specify the add. in the form when you create it, at the top you add a field type in the drop down select * Email Results to Set Address(es) next page has the field name i call it email then next box down, Email Address(es) to Send Form Results: you put the email add. you want the form results sent to, when you are done with the form don't forget to clik Create Sample Template button.....
mark
Re: CMSmailer usage
Posted: Mon May 29, 2006 3:54 am
by Dr.CSS
Re: CMSmailer usage
Posted: Mon May 29, 2006 4:05 am
by chipus
Yes, it is. I have the form already, but i don't know how to put the code into the content so it could work.
I mean i don't know where to put the CMSmailer code
Could u show me the code, Mark.
Thanks a lot
PS: do u use msn messenger or Ym ? i am happy to talk to u ^_^
Re: CMSmailer usage
Posted: Tue May 30, 2006 5:42 am
by Dr.CSS
ok here goes... you want to make a form and you want to be emailed the results...
install the CMSMailer module...
install the FeedbackForm module...
in the Extensions » CMSMailer Module... set like the first img. below... and send a test to your email add. in the Test Email Address: box
use a real add. ... check your mail in a few minutes, You Got Mail... ok it works..
in FeedbackForm .. 'clik' Add New Feedback Form... fill out info for form 'clik' Add button.. you get page with name and alias of form at bottom 'clik' "Add New Field" first field... Field Type: dropdown has * Email Results to Address(es) choose that.. next page looks like next img. below... fill in the info and 'clik' "ADD" button, now the form can be filled with your fields.. when you are done it will tell you what tag to use for the form eg. {cms_module module='FeedbackForm' form='
test'}
your form name... ok...
this works for me i don't know about the rest of that code stuff you guys were talking about...
{php} if ( isset($_POST['hid_frm_posted']) && ($_POST['hid_frm_posted']=='frm_posted'))
{ global $gCms;
$cmsmailer = $gCms->modules['CMSMailer']['object'];
$body = ''; $body .= 'Name: '.$_POST['fname'].'
';
$body .= 'Address: '.$_POST['address'].'
';
$cmsmailer->AddAddress('
chip.chipus@gmail.com','calguy');
$cmsmailer->SetBody($body);
[attachment deleted by admin]
Re: CMSmailer usage
Posted: Wed May 31, 2006 2:36 am
by chipus
ok, Thanks very much, mark
I am trying ^_^
Re: CMSmailer usage
Posted: Wed Sep 27, 2006 6:18 pm
by danster
Ques about using the php mail function independent of the CMSmailer module.
-----------------------------------
I have a form set up in a "content" page which submits to another "content" page in which I have placed a UDT called {testmailer}. the contents of the UDT testmailer are below. unforunat. it won't work. I've used this method in another site withouth any problems. is it possibly because I'm running "Maui" now as opposed to "Canary" in the other site? pretty frustrating. i realize the CMSmailer now exists, but I'm short on time and just want to wrap this up. thanks for any help or advice anyone can share.
if(isset($_POST['submit'])) {
$to = "
you@you.com";
$subject = "Form Tutorial";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];
$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message";
echo "Data has been submitted to $to!";
mail($to, $subject, $body);
} else {
echo "blarg!";
}
Re: CMSmailer usage
Posted: Wed Sep 27, 2006 6:47 pm
by danster
danster wrote:
Ques about using the php mail function independent of the CMSmailer module.
-----------------------------------
I have a form set up in a "content" page which submits to another "content" page in which I have placed a UDT called {testmailer}. the contents of the UDT testmailer are below. unforunat. it won't work. I've used this method in another site withouth any problems. is it possibly because I'm running "Maui" now as opposed to "Canary" in the other site? pretty frustrating. i realize the CMSmailer now exists, but I'm short on time and just want to wrap this up. thanks for any help or advice anyone can share.
if(isset($_POST['submit'])) {
$to = "
you@you.com";
$subject = "Form Tutorial";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];
$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message";
echo "Data has been submitted to $to!";
mail($to, $subject, $body);
} else {
echo "blarg!";
}
well, this has nothing to do with CMSMS. i can't even get the mail func to work outside of the cms app, in separate php files. UG!!!!