Laravel email confirmation email sent or failed, Email preview and editable - email

Laravel5 Currently i am facing issue unable to check the status email is sent and not even getting email failed and i am using mandrill api for sending emails
$mail = Mail::send('emails.pendingorder', $data , function($message) use ($domain, $order)
{
if ($order->other_email) {
$message->from($domain->email, $domain->website);
$message->to($order->email, $order->name)->subject('test Email ');
$message->bcc($order->other_email, $order->name)->subject('test Email ');
}else{
$message->from($domain->email, $domain->website);
$message->to($order->email, $order->name)->subject('test Email ');
}
});
if($mail){
echo 'sent';
}else{
echo 'Fail';
}
The second thing..
i created email templates in blade and i want to preview email in ckeditor if there any any chaning or modification require then i edit the content and send email. i havn't any idea how to to this :(
Its my first try with laravel email and i am totally stuck with it

Do you have correct configuration in config/mail.php? Remember to change pretend to false. Also, Mail::send returns void, so you will have to check status on your mandrill account.
For editing email before sending it:
create form with ckeditor
fill this form with your default template
after submitting you have email body in your request, you can pass it to your email view
If you want your email to be fully editable, instead of having email view with only one variable you can use:
Mail::raw('This will be body of your email', function($message) {
// ...
});

Related

Teams not displaying email sent via SendGrid

I'm trying to post to a Teams channel via the email address using SendGrid. However, the emails I send via SendGrid are not appearing. I ended up adding my personal email address as well, and I do receive that one as well as seeing the Teams email address in the To: field. I can also see in SendGrid dashboard that the email was send and delivered to the Teams channel address. I have validated that this address is correct, and have also posted via my non-work email address to that channel, so I know it's not because of a typo or an external email address. My guess is that there is something in the email meta data that is making Teams reject the email? Anyone have ideas 1) why Teams won't post the email coming from SendGrid and 2) how I might modify my request in SendGrid so that it works? Also, alternative suggestions on sending emails (for free) from nodejs are welcome.
Here is the code I'm using to send the email for reference:
var msg = {
to: ['TEAMSCHANNELID#amer.teams.ms','mycompanyemail#company.com'], // ChatBot Support Team, General Channel
from: 'noreply#chatbotapimonitor.com',
subject: `Service Interruption Notice: API ${test} is down (via ${functionName})`,
text: `API ${test} failed with error ${error}`,
html: `API ${test} failed with error ${error}`
};
try {
await sgMail.send(msg);
} catch (err) {
context.log(err);
}
It turns out that Teams won't accept incoming emails if the From address domain does not match the actual "sent from" domain. I recognized this by the "Sent via sendgrid.net" message I saw in Outlook when the emails were sent to me as well.
I was able to get the out of the box Incoming Webhooks enabled, and using that instead of SendGrid emails got around the problem. I got the URL from the webhook configuration and then was able to call it like so:
var headers = { 'ContentType': 'application/json'}
var body = {
'#context': 'https://schema.org/extensions',
'#type': 'MessageCard',
'themeColor': 'FF0000',
'title':`API ${test} is down: Service Interruption Notice`,
'text': `API ${test} failed with error ${error}.\n\r\n\rReported by ${functionName} during test started on ${now.toString()}`
};
var res = await request({
url: url,
method: 'POST',
headers: headers,
json: body,
rejectUnauthorized: false
});
The themeColor doesn't appear in all channels, but I have it working as a nice red/green indicator on Teams desktop.
Perhaps your organization limits the sending ability to only certain domains? Someone with admin rights can check it under Teams settings => Email integration
yeah that's what I meant - making your own Connector app and side-loading. If you go ahead with it, please let me know - would love to know how it works out
Yes exactly making your own Connector would work.

Send a contact us form details to email in Dart

I am making a Contact us form page in my Flutter app and would like to send the details of the form (email of the user, name and the message) to my email address when the user hits the Send button. I don't want to launch the gmail app from phone for this. Are there any other ways to this?
Thanks!
Of course, you can.
You can use the flutter_email_sender package or flutter_mailer package. Both of them are very similiar.
For example if you are using flutter_email_sender package,
final Email myFormEmail = Email(
body: 'Email body', // This could be from the form field's value
subject: 'Email subject', // Subject (maybe type of question, etc)
recipients: ['example#example.com'], // This is receiver (maybe your email)
cc: ['cc#example.com'],
bcc: ['bcc#example.com'],
attachmentPaths: ['/path/to/attachment.zip'], // Attachments
isHTML: false,
);
And then inside the 'SEND' button, add this kind of code:
await FlutterEmailSender.send(myFormEmail);
Please check "mailer" package from flutter. It will use smtp to send email from background without opening userinterface app. It has gmail, yahoo mail, mailgun options to send email.
The Reference link :
https://pub.dartlang.org/packages/mailer

Change WooCommerce invoice order mail recipient

I've set up a Woocommerce webshop and would like to change the recipient for the order invoice.
The website uses WooCommerce V3.6.5 with the Flatsome Theme.
I tried to change the admin email address in Wordpress settings but that didn't work. I still receive the invoice at the old email address.
I tried to look into the function.php but that only shows the following:
* #package flatsome
*/
require get_template_directory() . '/inc/init.php';
Does anyone know how to change the order invoice recipient? In the WooCommerce -> Settings -> Email tab I can only change the email formats and "From" email address.
I would go for this solution using $recipient variable, please have a try.
function change_email_recipient( $recipient ) {
global $woocommerce;
$recipient = 'email#email.com';
return $recipient;
}
add_filter( 'woocommerce_email_recipient_new_order', 'change_email_recipient', 10, 2 );

Powermail Email to friend

I want to create an 'Email to friend' form where the user enters an email address, and an email is sent to that address with a link to the current page url.
How do I set the receiver to be the email entered into the form?
plugin.tx_powermail.settings.setup.receiver.overwrite.email = TEXT
plugin.tx_powermail.settings.setup.receiver.overwrite.email.data = myemailfield??
.data = GP:tx_powermail_pi1|field|markername
But beware that your system can send emails to any email address that a user wants. Someone could use it for spaming with a "tipafriend" function.

Generating a verification token in Meteor without sending an email?

In my meteor app, I'm setting up the registration process.
Meteor has a Account.sendVerificationEmail method to send emails out to new users with a token to verify their email address
My app does need this functionality but I don't really want to use the sendVerificationEmail to send the emails because I already have my own email helper which has got a bunch of logic and I want all the emails in my system to pass to flow out of that function.
So my question is that I do want to create my verification token for the user on registration, but I don't want sendVerificationEmail to send an email out because I want to do it manually.
Is this possible?
First add the core "random" package for random code generation
$ meteor add random
Then intercept the account creation process
Accounts.onCreateUser(function(options, user) {
// create a verified flag and set it false
user.customVerified = false;
//20 character random lowercase hex string. You can use a hash of some user info if you like. I just put this here for demonstration of the concept :)
user.customVerificationCode = Random.hexString(20).toLowerCase();
//pass the new user's email and the verification code to your custom email function so that you can craft and send the mail. Please double check the option.profile.emails[0], the email should be available somewhere within the options object
myCustomEmailFunction(options.profile.emails[0], user.customVerificationCode);
// continue with account creation
return user;
});
At this point, if you don't want to show pieces of ui elements to unverified users, you can create a template helper for that. Or you can check if user is verified in your publications. Etc... whatever you want to restrict.
Now you can define a route in your app with iron router so that when the user clicks on the link, the route takes the verification code and set's the user's verified flag to true.
You can fake the verification record for the user in the MongoDB document and then send your own email:
//Fake the verificationToken by creating our own token
var token = Random.secret();
var tokenRecord = {
token: token,
address: Meteor.user().emails[0].address,
when: new Date(),
};
//Save the user
Meteor.users.update(
{_id: Meteor.userId()},
{$push: {'services.email.verificationTokens': tokenRecord}}
, function(err){
//Send an email containing this URL
var confirmUrl = Meteor.absoluteUrl() + '#/verify-email/' + token;
//Send using SendGrid, Mandrill, MailGun etc
});
Code taken from GitHub:
https://github.com/meteor/meteor/blob/5931bcdae362e1026ceb8a08e5a4b053ce5340b7/packages/accounts-password/password_server.js