Best PHP mailing library for Codeigniter-2 - codeigniter

Iam using CI-2 default mail class for sending emails. But it is not sending HTML based emails properly.
Can someone tell me good email sending libraries for CI2.
Thanks in advance

Try to configure the library to send html emails
$config['mailtype'] = 'html';
$this->email->initialize($config);

gmail and HTML content is a common problem; solutions have been suggested in the official CI forum with references to using Swift Mailer instead.

There is another solution I've found for poor HTML / Email Support.
Open up the Email Class:
System/Libraries/Email.php
Around Line 51 You'll see
var $send_multipart = TRUE;
Set this to FALSE and try again. I find CI's email library to be very good.

Related

Preview Laravel Mail before sending

I want to edit my mail and change everything, if I want, as shown here.
Ive imported my file and created a test route to view the page:
use Illuminate\Mail\Markdown;
Route::get('/mail/html', function () {
$markdown = new Markdown(view(), config('mail.markdown'));
return $markdown->render('vendor.mail.html.message'); // or ..markdown.message
});
However, Im having variable errors for #slot. How to view my change/see what the mail looks like before sending? Another package for that?
Thanks
To preview your email in browser please add below code to route
Route::get('preview-notification', function () {
$markdown = new \Illuminate\Mail\Markdown(view(), config('mail.markdown'));
$data = "Your data to be use in blade file";
return $markdown->render("path-of-your-templete-blade-file", $data]);
});
and you will be access your templete using
http://your-application-url/preview-notification
This is the recommended way by the Laravel community
kunal has a nice quick solution and that's how I used to do it. But now I use mailtrap.io to test emails because it allows you to replicate the whole process of sending an email.
Create a (free) account with mailtrap.io.
Add your mailtrap username and password in .env file.
By the way, Laravel is already configured to use mailtrap by default, so it is their recommended way to test emails.
Watch how Jeffrey Ways does it in his lesson:
Laravel 5.4 From Scratch: Sending Email
https://laracasts.com/series/laravel-from-scratch-2017/episodes/26
If you want to test in locally. You can put echo command in blade file at end and put die; this way you can test.Suppose you have test-email.blade.php
test-email.blade.php // file name
This is tets mail
<?php echo "test"; die; ?>
Hope it helps!

Send a email in Grails 3 with an image in it

I am trying to send an image within an email when in Development for a Grails 3 project. The email is sent through AWS email service. I have tried the img tag with absolute equal to true but have been unable to succeed in seeing the image in the email? Using asset-pipeline so it might be something related to that.
How do you achieve seeing the image in a email?
I used asynchronous send mail grails plugin for mail with image code part as follows:
File f = new File("IMG.jpg")
asynchronousMailService.sendMail {
from "senderMailID"
to "recipientsMailID"
bcc "BCCMailID"
subject "subject"
html "html code"
inline 'YourImageName', 'image/jpg', f
}
Then your HTML codes contains
<img src="cid:YourImageName" style="height: 60px">
I hope this helps you!
I would recommend you to use this grails plugin sending image or text etc. attachment through AWS.
http://grails-aws.github.io/grails-aws/1.7.5.0/guide/3%20Amazon%20Simple%20Email%20Service%20(AWS%20SES).html
And if your done with AWS mail configuration then you can use mail service like this:
Mail {
to "email#gmailcom"
subject "testing emails with one attachment"
body "..."
attach "/users/website/images/file1.jpg"
}
Hope this will help you!

Magento Transactional Email Logo and HTTPS (SSL)

In Magento CE 1.8, it appears {{var logo_url}} defaults to using an HTTPS link in its transactional emails (if SSL enabled). This causes an issue in Outlook, because Outlook will not display images with an SSL URL.
Is there any "easy" way to force {{var logo_url}} to HTTP?
I don't think it's a good idea to enforce anything to be HTTP instead of HTTPS but well... The easiest way I can think of would be to extend Mage_Core_Model_Email_Template_Abstract in a own extension (better) or to overwrite it in your local code pool (faster and okay but not so clean) and adapt the function _addEmailVariables($variables, $storeId).
For the sake for demonstration I'll show the second approach:
Copy app/code/core/Mage/Core/Model/Email/Template/Abstract.php to app/code/local/Mage/Core/Model/Email/Template/Abstract.php and create any folders which don't exist already in app/code/local/.
Now in app/code/local/Mage/Core/Model/Email/Template/Abstract.php in the function _addEmailVariables($variables, $storeId) look for
if (!isset($variables['logo_url'])) {
$variables['logo_url'] = $this->_getLogoUrl($storeId);
}
and replace it with something like this
if (!isset($variables['logo_url'])) {
$variables['logo_url'] = str_replace("https", "http", $this->_getLogoUrl($storeId));
}
Not tested but this should work. You can adapt this approach in an own extension as well. Check out the excellent articles on http://inchoo.net/ if you are not familiar with the proccess (http://inchoo.net/magento/overriding-magento-blocks-models-helpers-and-controllers/ is a good starting point).

ActionMailer fail with "Value cannot be null. Parameter name: uriString"

I'm trying to use ActionMailer 0.7.0 to send a email from my MVC 3 project.
I've followed the sample posted in the project site to the letter.
But when I try to send the email the following error always occurs:
"Value cannot be null. Parameter name: uriString"
It occurs the the #Url.AbsoluteAction in the email body.
#using ActionMailer.Net
#model User
#{
Layout = null;
}
Welcome to My Cool Site, #Model.FirstName
We need you to verify your email. Click this nifty link to get verified!
// The error happens in the line bellow
#Url.AbsoluteAction("Verify", "Account", new { code = #Model.EmailActivationToken.ToString() })
Thanks!
Can some one help me? What am I missing?
After struggling a few days trying to solve the problem using the code proposed in the sample I gave up.
I've download the source and found out that the problem occurs when your RouteCollection is not standard (which is my case).
So I found an elegant work around that worked for me.
Instead sending the Token to the view and use the Url.AbsoluteAction method I used the Url.Action with the protocol parameter in the controller and sended the complete url in the view model. Like this:
new EmailsController().ActivationMail(new ActivationMailViewModel { Email = data.Email, FirstName = data.Name, ActivationLink = Url.Action("VerifyEmail", "Mail", new { code = data.ActivationToken.ToString() }, "http") }).Deliver();
The view became:
#using ActionMailer.Net
#model User
#{ Layout = null; }
Welcome to My Cool Site, #Model.FirstName
We need you to verify your email. Click this nifty link to get verified!
#Model.ActivationLink
Thanks!
About the SMTP host problem, I found out that in Web.Config even if you set the deliver for "SpecifiedPickupDirectory" you need to add an empty host tag. It's not specified in any ActionMailer sample. Here is the final configuration:
<system.net>
<mailSettings>
<smtp deliveryMethod="SpecifiedPickupDirectory">
<network host="none" />
<specifiedPickupDirectory pickupDirectoryLocation="C:\temp\" />
</smtp>
</mailSettings>
</system.net>
I hope it helps someone.
Best luck for everybody.
I've just spent a couple of hours implementing ActionMailer into my MVC project.
I found Scott's screencast really helped me.
http://www.youtube.com/watch?v=QQRzYo7k9Vs&hd=1
It explains how to get round the SMTP host issue, as well as how to set up the User models etc.
I'm still getting stuck on user email verification and will try to let you know if I sort it out.
However, you don't need this to send 'ordinary' emails. So my advice would be to leave it out for now until you can get the emails working OK.
Hope that helps, and I'll be back to you when I sort out email verification!
Cheers
Chewie

Joomla 1.5: why does trying to send email result in: PHPMAILER_RECIPIENTS_FAILED

I'm trying to send emails from Joomla! 1.5.9, but keep getting this error message: PHPMAILER_RECIPIENTS_FAILEDrecipient_name<recipient_email>
A few more facts:
It's a WAMP server (joomla 1.5.9, PHP 5.2.8)
Validation emails are sent with no problem at all
Joomla! is set to use SMTP
The IIS SMTP service is used (though I'm not 100% sure about it's configuration)
The diagnostics tool smtpdiag shows no problem when checking the sender/recipient
Any ideas?
Thanks,
Omer.
Perhaps this has already been answered before # Joomla forums itself.
http://forum.joomla.org/viewtopic.php?f=431&t=272547
I tried many of the solutions given in the link Sukumar provided but none of them worked.
Then I tried to use PHP mail function instead of SMTP and it worked :)
Change the following line in configuration.php in the root folder
var $mailer = 'smtp';
to
var $mailer = 'PHP mail';

Resources