This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
I've read the Sending mails section in the documentation: http://octobercms.com/docs/plugin/email but I've trouble understanding the path to the email view.
I've placed my view mail called booking.html
under the path /plugins/emzero/booking/views/email
and in the code I'm using:
Mail::send('emzero.booking::emails.booking', $data, function($message)
{
...
});
But I'm getting No hint path defined for [emzero.booking].
Do I need to register a custom plugin to send an email? Any detailed information would be really appreciated.
Thanks
For example:
title = "Home"
url = "/"
layout = "default"
description = "De hoofdpagina"
[blogPosts shortPosts]
postsPerPage = "3"
categoryPage = "home"
postPage = "insides"
noPostsMessage = "Geen insides gevonde"
[blogPosts fullPosts]
postsPerPage = "100"
categoryPage = "404"
postPage = "insides"
noPostsMessage = "Geen insides gevonden"
==
<?php
function onSend()
{
$data = Input::all();
$rules = ['naam' => 'required', 'email' => 'required|email', 'bericht' => 'required'];
$msgs = ['required' => 'Vul alstublieft alle velden in','email' => 'Vul een geldig e-mailadres in'];
$v = Validator::make($data, $rules, $msgs);
if ($v->fails())
{
$this['result'] = $v->messages()->first();
}else{
Mail::queue('emails.aanvraag', $data, function($message)
{
$message->from(post('email'), post('naam'));
$message->to('dogname@doghouse.com')->subject('Nieuwe vraag via de website');
});
$this['result'] = 'Email verstuurd';
}
}
?>
==
<div class="panel-footer" id="result">
{% partial "aanvraagresult" %}
</div>
<form data-request="onSend" class="questionform borderbelow" data-request-update="aanvraagresult: '#result'">
<input type="text" name="naam" placeholder="uw naam"/>
<input type="text" name="email" placeholder="e-mailadres"/>
<textarea name="bericht" cols="30" rows="5" placeholder="uw vraag..."></textarea>
<button type="submit" class="formsubmit">Verstuur uw aanvraag >></button>
</form>
If you can't find a view, then you could alter your views directory. Go to app/config/view.php and alter the path
'paths' => array(__DIR__.'/../../themes/'.Config::get("cms.activeTheme",'').'/partials'),
This way you dont need to write a plugin and can have it in your theme folder.
oh and here is the partial to display info:
{% if result %}
<span class="lead">
<span class="label label-success">{{ result }}</span>
</span>
{% else %}
<span class="text-muted">
<!-- nothing -->
</span>
{% endif %}
Last updated
Emzero, make sure you have registered your plugin using a Plugin.php file, this is where the view registration occurs.
Hi!
Hi! When I use the code:
$rules = ['name' => 'required', 'phone' => 'required|regex/(+7|8)((\d{3})|\d{3})\d{7}$/'];
I get an error "preg_match(): No enfing matching delimiter ')' found" on line 1308 of ...sitename.../vendor/laravel/framework/src/Illuminate/Va;idation/Validator.php
Can anyone help me please?
AlecSPB: I'd recommend a tool like http://www.regexr.com/ to figure out what's wrong with your regex. :-)
AlexSPB: The plus symbol in regexes has special meaning. Try escaping it: (\+7|8)((\d{3})|\d{3})\d{7}$
Last updated
I am also getting an error "no hint path defined for [contact]". This is a fresh install of OctoberCMS so I'm not sure I should have to be messing with the code base, although I've tried. I've installed Octobercms here http://www.earthlessness.com/october
Also looks like this is relevant but I don't know where to set this. http://stackoverflow.com/questions/22135765/laravel-using-packages-with-psr-4-gives-message-no-hint-path-defined-for
Thanks for your help
Last updated
webservicegenius9820 said:
I am also getting an error "no hint path defined for [contact]".
Try reading the documentation here.
Last updated
It turns out there was a readme file I didn't notice. At least no more errors.
The contact page requires a mail template to be created. You can create a new mail template by selecting Settings > Mail templates > New template.
- Select the layout Default
- Enter the code:
contact::form
- Enter the subject: Contact form submitted
- Enter the description: Sent when a user submits the contact form.
-
Enter the HTML below:
<p>From: {{name}} {{surname}} <{{email}}></p> <p>Phone: {{ phone }}</p> <p>Company: {{company}}</p> <p>Message Body:</p> <p>{{comments}}</p> <p>--</p> <p>This mail is sent via contact form found on House of Chairs!</p>
- Click Create
it's path is set in plugins->views. here you have to create a folder like mail folder, after in folder you have to set message.htm template. after you have to write like this.. Mail::send('mail.message::..., $data, function($message) { ... });
Make sure that your Plugin directory is like this:
plugins/ <=== Plugins directory
author/ <=== "author" segment
plugin/ <=== "plugin" segment
views/ <=== View directory
mail/ <=== "mail" segment
message.htm <=== "message" segment
In my case I had view instead views.
Hello i am in same problem. It looks like it did not register namespace for plugin correctly. Stack Trace: ...\OctoberCMS\vendor\laravel\framework\src\Illuminate\View\FileViewFinder.php:112 ...\OctoberCMS\vendor\laravel\framework\src\Illuminate\View\FileViewFinder.php:90 ...\OctoberCMS\vendor\laravel\framework\src\Illuminate\View\FileViewFinder.php:76 ...\OctoberCMS\vendor\laravel\framework\src\Illuminate\View\Factory.php:151 ...\OctoberCMS\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:215 ...\OctoberCMS\modules\system\models\MailTemplate.php:122 ...\OctoberCMS\modules\system\models\MailTemplate.php:111 ...\OctoberCMS\modules\system\models\MailTemplate.php:130 ...\OctoberCMS\modules\system\models\MailTemplate.php:142 ...\OctoberCMS\modules\system\ServiceProvider.php:302 ...\OctoberCMS\vendor\laravel\framework\src\Illuminate\Events\Dispatcher.php:221 ...\OctoberCMS\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:219 ...\vendor\october\rain\src\Mail\Mailer.php:203 ...\OctoberCMS\vendor\october\rain\src\Mail\Mailer.php:49 ...\OctoberCMS\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:219
1-16 of 16