Mail::sendTo($to, 'OctoberCMS.PhotoElegance::mail.contactform', $params);
When this line of code is called I get back an error which says the following:
"No hint path defined for [OctoberCMS.PhotoeElgance] on line 112 of vendor\laravel\framework\src\Illuminate\View\FileViewFinder.php"
In simple, I am trying to send mail when the contact form is submitted. The code is inside a function called onStart(). I discovered that the appname is OctoberCMS. After the dot I have PhotoElegance as that is the website name.
After the hint path (OctoberCMS.PhotoElegance) I am calling the static function (mail.contactform) to my defined contact form which has been built in the CMS.
Where do I find out the appname and website name. How do I define these if I want to change them. I understand this is to do with name spacing but I cannot figure it out.
hi the way you try to send an email is called "Mail view" this is the way you do send mail form a plugin, and the path to the mail view is author.plugin::path.to.view.
From the very short definition of your problem i can tell that you are not using plugin but the dynamic pages feature of october cms so you must use "mail template" .
Go to setting > find mail->mail template in the left side bar > click new template chose a code once done you can use this tempalte to send email from dynamic page.
Mail::sendTo($to, 'template.code', $params);
Related
I have an application in TYPO3 CMS. It has an extension test_extension that has a controller and an action. This action should return some JSON.
class TestRequestController extends ActionController
{
public function testAction(): void
{
echo json_encode([
'test' => 123
]);
}
}
I want to be able to request this action via Postman. How can I do that? TYPO3 version - 8.7. Thanks in advance!
Creating Links
Usually extbase-extensions are created with the help of the extension extension_builder. This extension creates by default templates and links to open list- and detail-view.
It's possible to add additional actions and to create according links.
Also the usage of the templates is not required and your way to return the result of the action without usage of a template is possible.
The logic of the links is this, I break the parts down in single lines:
tx_extension_plugin[controller]=TestRequest
tx_extension_plugin[action]=test
There are still more parameters commonly used like id or search, but it's also possible to define individual parameters.
In your case the listed parameters seem to be sufficient and the link would look like this now:
www.example.com/?id=123&tx_extension_plugin[controller]=TestRequest&tx_extension_plugin[action]=test
for the extension news this would look like this, this is with your parameter-values which are not available in news. This example shows only how the extension-related part is handled (tx_news_pi1):
www.example.com/?id=123&tx_news_pi1[controller]=TestRequest&tx_news_pi1[action]=test
id is for the page here and not a parameter for your extension, else id had to look like this tx_extension_plugin[id]=123. So all extension related parameters have the form tx_extension_plugin[parameter]=value.
While it's possible to create those links with the API, it's easier to create them with the view helpers for the fluid templates. Note that sometimes an hash is added at the end, like this example: &cHash=1234567890.
The cHash-value you can't create without viewHelper or API, so the knowledge about the parameters and the other values is not enough to create the links.
Calling the link
Most often links are directly called by the browser and visible in the URL-bar. But sometimes and in your case you might call the links by AJAX, so that the json is loaded without being directly shown to the user.
It's also possible to wrap the json in script-tags, so that it's every time loaded when the whole page is called, it's not dynamic then and without AJAX it can't adjust to some user-interaction without loading a whole page again.
AJAX responses can be realized in many ways in TYPO3, the most easy one is to define a special page-type and a special page in the pagetree for it. On this page you add the plugin of your extension to return the json. This "Ajax-page" has to be configured to have the correct header for Json and must not return anything else but the JSON, so all HTML-Output has to be disabled.
I am using php sdk to send html mails. I want to add some fields in my html template and then from php set the values of these custom fields. But I don't know how to access custom parameters in html. Lets say "projectName" is my custom parameter then I tried to add proejctName in html using {projectName}, {{projectName}} and {{$projectName}} but none of them are working. I am setting their value by calling the function addCustomParameter().
e.g.
$messageBldr->addCustomParameter("projectName", "My project Name");
But in my email I am getting only html not the value of projectName. If I have more than one custom paramter, do I need to call addCustomParameter () as many time?
I have a controller QuickContacts with an action add() which uses CakeEmail to send a message, like so:
$Email = new CakeEmail();
$Email->from(array('noreply#xyz' => 'xyz'));
$Email->to(($this->isBranded) ? $this->brandedAccount['BrandedAccount']['contact_us_email'] : EMAIL_TO_MAIL_ADDRESS);
$Email->subject(EMAIL_QUICK_CONTACTS_SUBJECT);
$Email->emailFormat('html')->template('add', 'default');
$Email->message($this->request->data);
$Email->send();
When I try and send the mail, I get an error indicating that a view file does not exist:
Missing View
Error: The view for QuickContactsController::add() was not found.
Confirm you have created the file: Emails/html/add.ctp in one of the following paths:
/var/www/html/mysite/app/View/Themed/Xyz/Emails/html/add.ctp
I can certainly confirm those files exist, but for some reason CakePHP still is unable to find them, and I can't figure out why this might be happening. Can anyone point me in the right direction?
You have to explicitly set the theme in CakeEmail:
$Email->theme('xyz')
as described in the Cookboox 2.x: Sending Templated Emails.
The error message is pointing you towards the correct path, but CakePHP is looking for your file in:
/app/Emails/html/add.ctp
This may be due to a bug.
I am able to send mail using swiftmailer extension. I am also able to include the view file from #app/mail folder.
Now I am wondering how I can include the data for my model views for example say I have a Model City.php and related view as view.php or index.php(grid-view) how can I include the data rendered in view.php(single record) or table data in index.php in mail body.
In short I want to include the default data rendered in yii2 in views or index in mail body.
Hi, I have seen this example like - Yii::$app->mailer->compose('viewName', ['variable' => $variable])
another example - Yii::$app->mailer->compose('contact/html', ['contactForm' => $form])
I have tried like this without much success:
Yii::$app->mailer->compose('medicine-request-entry/html',['medicine_request_entry'=>$form])
but I am getting the error undefined variable form. medicie_request_entry is the folder in views folder.(not in #app/views)
but couldn't get it. Say my view name in /mail/ subfolder is say report.php and I have a folder in my views subfoler /city/ and in city folder there is view.php and index.php how I can specify this in the parameter in the example code.
Any suggestion will be greatly appreciated.
Thanks.
Ok I found the solution and putting the answer for anyone having the same difficulty
I modified the code in my controller like:
Yii::$app->mailer->compose('#app/views/medicine-request-entry/view',['model'=>$model])
But I still didn't get, how to use layout given in #app/mail or to send the mail as html.
Thanks.
\Yii::$app->mailer->htmlLayout = "#app/mail/layouts/html";
$message = Yii::$app->mailer->compose('#app/mail/welcome');
var_dump($message);
I have got a wordpress instance with the plugin contact-form-7. In some tutorials, I saw that I can do something before sending the mail with this code:
add_action("wpcf7_before_send_mail", "wpcf7_do_something_else");
function wpcf7_do_something_else(&$wpcf7_data) {
// Here is the variable where the data are stored!
var_dump($wpcf7_data);
// If you want to skip mailing the data, you can do it...
$wpcf7_data->skip_mail = true;
}
I got the code from here http://code.tutsplus.com/tutorials/mini-guide-to-contact-form-7--wp-25086
But somehow, it is not working. I don't receive any error - the contact form is not sending the mail anymore, even without the $wpcf7_data->skip_mail = true, and it doesn't print anything.
My questions:
Where do I have to write this code? Directly into the plugin? (At the moment, I wrote this code into a custom plugin, maybe wrong?)
Is it even possible to print any data from the form in there? (Is the tutorial bad?)
Thanks!
Well, it is normal that the contact form does not send email anymore, as it is defined on this line $wpcf7_data->skip_mail = true;.
This code is used if you want something else than the default posting (sending in email), as described in the tutorial.
This code, however, should be placed in your theme's functions.php file (if file exists, create it). But still, the email will not be send.
If you want to skip emails and perform other action, then leave this piece of code
$wpcf7_data->skip_mail = true;
and add your logic after this line.
Describe more precisely what do you want to do (instead of sending email) in your question.