How to set SwifMailer plugins when using the Laravel mail class? - email

Laravel does not return any useful information to show the reason that email fails. The SwifMailer Logger plugins helps with debugging during the process of sending. What is the correct way to set this plugin (and other swifmailer plugins) when emails are sent through Laravel's Mail class?

Use
Mail::getSwiftMailer()->registerPlugin();
You can place this code into some service provider for example to be executed on application startup. Or you can override Illuminate\Mail\Mailer entirely if you want.

Related

Execute code upon content-changes in TYPO3

Is it possible to notice if the content changed in the Backend and then, for example, to send a mail?
In other words, can I somehow notice who modified the contents in the backend and then automatically send an email?
Yes. When content is changed in the backend, several hooks are called before and after the database operations. You can register for each of those hooks. The class you want to have a look at for the right hook is \TYPO3\CMS\Core\DataHandling\DataHandler.
You can e.g. register a class for the processDatamap_afterDatabaseOperations hook by adding the class name to the array
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass']
in your ext_localconf.php.
You can find more about hooks in TYPO3 here: https://usetypo3.com/signals-and-hooks-in-typo3.html

Mule ESB Email Attachment filter

Just wanted to ask some help on the Inbound Email scenario. I have setup one mailbox to receive CSV files that contains different mappings for each. I know I can use the choice filetr for it but I can seem to get the correct attachment name values on the email. Any thoughts?
Thanks
I will give you a general answer for situations like this.
When you don't know exactly what property values you are looking for, or what classtype they are, use the debugger in Anypoint Studio. Open your project, add a logger and set a breakpoint on it just after your inbound, and run it in debug mode. Trigger the flow to start, in this case by sending an email to the box it is polling.
Next, you will see the debug perspective and will be able to see the attachment as an inbound property (if i remember correctly). You will also see its type. If you are handling a more complex object, just add a Groovy Script to build the logic needed, and set a simple flag in another property that you will later use in your filter.
Hope it helps.

External access to Magento instances

I've started investigating alternatives to my project and a few questions came out that I couldn't answer by myself.
The problem is: I want to create a web page able to access multiple Magento instances installed in the same server. Currently, I have one Magento instance per client and this project will access several Magneto instances to export reports from each one (for example).
The alternatives I thought til this moment are:
Have another Magento instance, create a new module within it that changes its 'database target' before triggering operations/queries;
Questions until this moment:
Can I 'change the database target' of a Magento instance?
How can I access data from a Magento instance without appeal to SOAP/REST?
I want to re-use some components (grids, tabs, forms..) from Magento, that's why I'm not considering an independent project (Zend, for instance) that can access this code from another projects. Does it make sense?
Any other idea?
==Edited==
Thanks by the tips and sorry by my ignorance. The comments let me believe that I'm able to execute something like this:
// File myScript.php
require '/home/DOMAIN1/app/Mage.php';
Mage::app('default');
// get some products from DOMAIN1
require '/home/DOMAIN2/app/Mage.php';
Mage::app('default');
// get some products from DOMAIN2
Is it right? Can I execute require twice (and override things from first require)?
==Edited2==
I'm still trying to connect to several Magento instances from a single third party file. Is there any tip? I'm facing several/different errors at this moment.
The only thing I know is that I can still rely on SOAP to get the information I need, but this will be expensive.
Thanks!
The easiest way would be to include Mage.php from each shop instance. You would need to use namespaces or some other trickery to be able to load more then one.
Or if that doesn't work - make your own API in a separate file to get what you want from one shop, and combine the results in the PHP-file that calls the API.
Here's a sample on how to use Magento functionality outside of Magento:
require 'app/Mage.php';
if (!Mage::isInstalled()) {
echo "Application is not installed yet, please complete install wizard first.";
exit;
}
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
// your custom code here, for example, get the product model..
$productModel = Mage::getModel('catalog/product');

Grails + GWT - using the same Date Format

I am developing an app using Grails and GWT for a client side.
I want to use the same date format both on the client side and on the server side (preferably defined in one file).
So far i've understood that Grails got it's own mechanism for internationalization (grails-app/i18n). I know i can access these messages from any server code using app context.
I can also access any resource file inside web-app directory.
For the client side, i can use ConstantsWithLookup interface and GWT.Create(...) to get an instance of it.
But, i still haven't found good solution to integrate these two together, so i have date format defined in one place. Any ideas or tips?
Thanks,
Sergey
After digging into Grails more, i came to a solution.
I've put constant into .properties file under grails-app/i18n.
Then, i hook to eventCompileEnd and i copy resources from grails-app/i18n to specific package in target\generated-sources.
After this step is completed, i generate google I18N interfaces using copied property files.
I've put this functionality to separate plugin.
_Events.groovy:
includeTargets << new File("${myPluginDir}/scripts/_MyInternal.groovy")
eventCompileEnd = {
internalCopyMessageResources();
}
eventCopyMessageResourcesEnd = {
generateI18NInterface();
}
Now it is possible to access localized data from server side and from client side.

Asp.Net and External DLL

i'm writing a web application that works with an external dll (activex),
the dll was written by skype developers,
the problem is that,
in a case of any event (status changing, attachment, etc..) in the client side, a delegate needs to be call on the server side.
so when i'm changing a status in the skype program, it seem that a postback really happen but there is no affect on the client side.
for example , i'm trying to change a label content by his new value from the server side (using label that runat server) but nothing change.
i succedded to make a java script interval
so when it recognize any changes
it replace the content of the label.
i preffer not to use it because the dll already support that events.
thanks in advance.
It seems that your problem is simulating a post-back to make the label change its contents. If so, this link might be helpful:
Using doPostBack Function in asp.net