Laravel customize email verification - laravel

Im trying to customize the email verification email.
In the file \vendor\laravel\framework\src\Illuminate\Auth\Notifications\VerifyEmail.php
I can see the following:
return (new MailMessage)
->subject(Lang::get('Verify Email Address'))
->line(Lang::get('Please click the button below to verify your email address.'))
->action(Lang::get('Verify Email Address'), $verificationUrl)
->line(Lang::get('If you did not create an account, no further action is required.'));
}
The language of my application is nl and so far all my translations work.
I added a file messages.php to \resources\lang\nl with the following content:
<?php
return [
'Verify Email Address' => 'Bevestig uw email adres',
];
However when the email is send the subject is not changed with the translation.
Where should I put the translation?

I found the solution, I have to add a file \resources\lang\nl\nl.json and add the following:
{
"Verify Email Address" : "Bevestig uw email adres"
}
Now it works as expected.

Related

Laravel dynamic email not sending by Mailable Class

In my case, In the Mailable Class I store the email in the variable hardcode form LIKE
$email = 'abc#example.com';
then, its work fine. but when we pass the email dynamically from the Controller LIKE
$this->email;
this shows the error are given below :
Expected response code 250 but got code "550", with message "550 The from address does not match a verified Sender Identity. Mail cannot be sent until this error is resolved. Visit https://sendgrid.com/docs/for-developers/sending-email/sender-identity/ to see the Sender Identity requirements "
$subject = 'Account Created Successfully';
$name = 'Saakin Qatar';
return $this->view('emails.AgencyRegisterMail')
->from($address, $name)
->cc($address, $name)
->bcc($address, $name)
->replyTo($address, $name)
->subject($subject)
->with('inputs', $this->inputs);
It works but when I pass the address from the controller and store it like below:
$subject = 'Account Created Successfully';
$name = 'Saakin Qatar';
$name = 'Saakin Qatar';
return $this->view('emails.AgencyRegisterMail')
->from($address, $name)
->cc($address, $name)
->bcc($address, $name)
->replyTo($address, $name)
->subject($subject)
->with('inputs', $this->inputs);
then it returns the error
Twilio SendGrid developer evangelist here.
The error message here said:
Visit https://sendgrid.com/docs/for-developers/sending-email/sender-identity/ to see the Sender Identity requirements
On the page it recommends you visit it describes that to send emails you need to send them from either an email address that has been verified or an email address from an authenticated domain.
My guess is that you are building a contact form of sorts and trying to send the mail from an email address that a user enters into the form. If that is the case, you cannot use the user provided email address as the from parameter for sending the email, you have to use an email address that is verified or authenticated. But you can set the user's email address as the replyTo so that when you reply from your email client you write back to the user.

Sent Mail checking if it is delivered and open to recipient in Laravel

I want help in scaffolding code with Laravel default Mail package to send an email to the recipient with an enhancement that checks the status either mail is delivered to recipient and then check that either recipient opened the mail or not and then change the status of that email in my db_email_list. I googled it that to add headers just like follow the example but could not get it how to get the status
$message->getHeaders()->addTextHeader('X-Confirm-Reading-To','recipient_mail');
$sendEmail->getHeaders()->addTextHeader('Disposition-Notification-To','recipient_mail');
$sendEmail->getHeaders()->addTextHeader('Return-Receipt-To','recipient_mail');
When the user has gotten the email: Simply use this piece of code:
if (count(Mail::failures())) {
return false;
} else {
return true;
}
true=delivered, false=not delivered
When user reads the email: Hm sounds like you need to include a trick in your email in order to know if user has opened/read the email by simply adding for instance including an image on your email with a route defined in your end and passing user id as query param.
<img src="http://www.example.com/user-read-email?user_id=20" />
So whenever the user opens the email img src will fire a call to your url and simmply get the user id from the url, and set the flag for that user in db.

Laravel Mail the from and replyTo are ignored in the received email

I have problem with the Laravel's Mail. I have nothing wrong with the source code to send an email. The email was sent but the email address of sender is mine instead of sender. It is the one in the config file. The replyTo was ignored also.
My code is as following:
Mail::send('appointments.emails.new_appointment', ['data' => $data], function($message) use ($sender)
{
$message->from($sender['email'], $sender['name'])
->to('myemail#gmail.com', 'My Name')
->replyTo($sender['email'], $sender['name'])
->subject('Contact from ' . $sender['name']);
});
I received an email with sender name and my email address. And, when I click on rely, it replys to myself. That means the replyTo didn't work. How can I fix that?
Sorry if my English is not so good.

Magento send email in custom module

I Need to create an email template. Also I need to load that customer template into another .phtml file and edit before send the email. After editing only I need to send the email. Can anyone please help me how to do this?
I searched and tried for this, but I only found articles related to send email without editing the existing email template.
example: http://www.caritorsolutions.com/blog/158-send-email-from-custom-module-in-magento
You can create an email template when going to System > Transactional Emails. The name you put in is the unique identifier for that template.
<?php
$templateName = 'template_name_you_put_in_in_the_backend';
$to = 'johndoe#example.com';
$customerName = 'John Doe';
// Load our template by template_id
$emailTemplate = Mage::getModel('core/email_template')->loadDefault($templateId);
$vars = array(
'customer_name' => $customerName
// Other vars that can be used in the mplate
);
// Store sends it
$senderName = Mage::getStoreConfig(Mage_Core_Model_Store::XML_PATH_STORE_STORE_NAME);
$senderEmail = Mage::getStoreConfig('trans_email/ident_general/email');
$emailTemplate->setSenderName($senderName);
$emailTemplate->setSenderEmail($senderEmail);
//Send the email!
$emailTemplate->send($to, $customerName, $emailTemplateVariables);
You can of course edit this file through System > Transactional Emails. If this isn't what you mean, can you clarify what you mean by 'editing the existing email template' ?

Enter email address and phone number before accessing survey

I am new in joomla 1.5 .
I am trying to implement a survey form. If the user is not a registered user then he or she can access the survey form after providing his or her email address and phone number. Else if the user is a registered user then he/she can get the access the survey form directly, no need to provide the email or phone number. Then according to that survey admin can interact with him / her through that email id or phone number.
How shall I progress according to this scenario.
//detect if a user entity exists in the session:
$user = JFactory::getUser();
if ($user->guest) { //this is a registered user
//redirect to the survey page
header('Location: http://www.example.com/your-survey');
}
else{
//display a form
//with email & phone number
}

Resources