This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

perseus.lonten
perseus.lonten

i create a mail template on panel settings. I just need to use it on my contact page but i dont know how can i use that My mail template:

From: {{name}} {{surname}} <{{email}}>

Phone: {{ phone }}

Message Body:

--

This mail is sent via contact form

My page

form

I just wanna when i click the send button, my mail send with form posts

From: {{name}} {{surname}} <{{email}}>

Phone: {{ phone }}

Message Body:

--

This mail is sent via contact form

Have a good one!

rajakhoury
rajakhoury

You need to register that template in your plugin then when using the Mail() function you can reference to this template.

 Mail::send('acme.plugin::views.templatename', $vars, function($message) {
 $message->to('admin@blabla, '....');
 $message->subject...
});

Last updated

perseus.lonten
perseus.lonten

should i use a plugin? Which one do you prefer?

rajakhoury
rajakhoury

Yes, you can use a plugin. I can't recommend any because I haven't used them but I'm sure it will do the job.

Read this post on SO, it may also help you get started if you decide to build your plugin http://stackoverflow.com/questions/29409963/octobercms-post-form/36485700#36485700

The workflow is basically :

  • Create an HTML form on your page
  • Add an AJAX request on submit either by using HTML data attributes or the JavaScript API
  • AJAX handler points to your component / plugin that will handle form submission
  • You can validate server side if you want or both
  • All is ok, send the mail. See October's documentation for sending mail, pretty much straight forward. You can add the SMTP settings in your Backend

Last updated

perseus.lonten
perseus.lonten

Thank you so much ^^

godhanipnj13117535
godhanipnj13117535

if i used header & footer separate files in mail and content file is also separate then how will to integrate with each other in mail function. Because i would be used template in mail functionality. so please help me., i don't know how to used it.

1-6 of 6

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.