Email sent via Sendgrid getting late delivered to customers - laravel-4

We are using SendGrid to send email to customers once they get registered on our website.
We have two portals:
One is live, and another is a test portal.
When customers are signing up in the live portal, the email is getting delayed about 5 minutes to reach the customer, but when the customer is receiving the mail after 5 minutes, the time of receiving mail is showing exactly the same time at which customer did signup.
Whereas in the test portal, emails are getting delivered at the correct time.
The code in both portals are totally the same.
This problem is happening with only Gmail, but I am not able to find out why emails are getting delivered late in live portal.
If anyone faced this same problem before, can you please guide me to solve this?
Here below is the code to send email
if($input['email']!= ''){
$email = $input['email'];
$username = Input::get('name');
$password = Input::get('password');
if($userdata->email != '')
{
Mail::send('emails.templates.activation',
array('username' => $username,'customer'=>$customer,'code'=>$code), function($message) use ($userdata) {
$message->from('support#buynuse.net', 'Buynuse');
$message->to($userdata->email, $userdata->username)->subject('Please activate your new Buynuse account');
});
}
echo 'email';exit;
}

Related

Send emails from different senders with Laravel proyect

Ive been doing some research about the best way to configure a contact us function with Laravel. I just want the clients of my website can email me their questions.
So is safe without using mailables? like;
Mail::plain('Hello {{ $user }}, welcome to Laravel!', ['user' => 'John Doe'], function ($message) {
$message
->to(...)
->subject(...);
});
Or would be a way to use pex mailgun but with different senders each time. Sound weird I know, but Im lost. If that isnt posible, I could use the same from but add an email input in the form so I'd know who is sending the email.
I hope you can send me some light.
Thanks in advance!

Laravel 5.8 : mail notification for a user with no email value doesn't fail?

In classic way, a registered or activated user will necessarily always have an email.
In my specific context we have to deal with few users with no email address. The activation relies on many fields already in database, and email is not necessarily needed.
In this context, anyway we have to send notifications campaign to users to send them informations.
I deal with the fail function to retrieves failed notifications and list them on an interface.
The problem I'm facing is with users without any email.
I was expecting that sending a notification to a user without any email address would fail but it's not the case. I need to be able to add those users to the failed notifications list...
The notification just goes its way with no fail.
Am I missing something here?
Sorry, I should have been more specific:
The notification use a notification class that sends notification via mail and database with queuing.
Each notification is recorded in database and has a state into its 'data' field set to 'OK' when it goes well or 'FAILED' when it fails.
I've solved the problem by managing throw the loop: if the user has no email then the notification mail is not sent and the notification is created manually into the database with the 'FAILED' flag via a custom method 'force_mark_notification_as_failed'.
foreach ($users as $user) {
if ($user->email != '') {
$when = $when->addSeconds(1);
$user->notify((new MailNotificationManager($campaign_id, $users_amount, 'releve_notes', $user->email))->delay($when));
} else {
$this->force_mark_notification_as_failed($campaign_id, $users_amount, $user->id);
}
}

How to know mail send or not send in laravel and which recipient is not getting it?

Hi I am using the bellow function, can you please guide me how can I use Mail::failures(); in it
Mail::send('emails.caregiversetprimary', $templateArray, function($message)use($email)
{
$message->to($email, 'username')->subject('my subject');
});
Mail::failures(); < ====== this gives me black array as I have used wrong email
I am using laravel 4.1
tl;dr
You can know which recipients the email has been sent to but no which recipients have received it.
details
You need a better understanding of how mail servers work. From a Laravel point of view, there is no way (or at least not a simple one*) of knowing which recipients got the email. Its a matter of how mail protocol works. You may know which recipients the message has been sent to but no which recipients actually got it.
With Mail::failures() you get a list of recipients to which Laravel tried to send the email but it failed on actually sending it. But again, if it has been sent there is no straightforward way to known if the mail reached their inbox or no.
*If you happend to use Mailgun, Mandrill or any other 3rd party software then you are not dealing with a mail server 'per se' but with an API service. May be you could check the mail service provider documentation to research if they perform any kind of delivery tracking that you can programatically check.

Laravel 4 and AmazonSES Emails not delivered

I had success setting up Laravel 4 mailer with AmazonSES smtp endpoints to send out emails using the Laravel default mailer and smtp.
This seems to work fine ( with most cases ).
We have a process that sends out approx 10k emails. But a few emails address are skipped and emails dont seem to get delivered to particular email addresses. I tried sending emails to 3 different email addresses of the same domain , which results in the mail never getting delivered to 2 email addresses. But the other one seems to work fine.
Same as for gmail addresses emails don't seem to get delivered to one particular email address. Apart from Geography there is no other common factor amoung the email accounts that don't receive the emails.
Any idea ? I am quite lost.
Updating the config/mail.php with the below worked
host => 'aws_end_point' // ie. email-smtp.us-west-2.amazonaws.com
username => 'your_aws_key'
password => 'your_aws_secret'

How do I complete purchase with Omnipay Sagepay using sagepay server (inframe)

I can't seem to find an instructions for Omnipay\SagePay, and am struggling to complete the purchase when SagePay posts to my notification URL.
Can anyone provide info, or point me to where I can find out what actions and parameters are needed for the notification URL to complete the purchase please?
Sagepay is tricky because the notification part is done by Sagepay and not by the client, so make sure you give an Internet accessible notification URL (that was my first mistake). Here's some example code (using Laravel) to process a Sagepay payment:
public function postProcess($transactionId)
{
//get the order details from somewhere
$order = $this->order->findByTransaction($transactionId);
$response = $this->gateway->completePurchase(array(
'transactionId' => $order->transaction,
'transactionReference' => $order->reference,
'amount' => $order->total,
'currency' => $order->currency,
))->send();
if ( ! $response->isSuccessful())
{
$response->invalid(URL::to('checkout/problem'));
die();
}
$response->confirm(URL::to('checkout/complete/'.$transactionId));
}
As you can see it's quite a bit different from the other examples as you need to call completePurchase() and then separately send a response to confirm.
Let me know if you need anymore help.
Cheers
From here you can either read more about the integration methods or scroll to the bottom of the table to download the Server documents. Our kits are available for you to download.
Are you getting an error message when Sage Pay is trying to reach your NotificationURL? Or, are you getting notification that Sage Pay has contacted you via your NotificationURL but you are not able to redirect the shopper to the RedirectionURL, the landing page to tell the shopper about the status of the transaction?
Few points to check for a 5006 error (Unable to redirect to the vendors website. The vendor failed to provide a RedirectionURL).
Is the SecurityKey matching?
If the transaction is not showing in My Sage Pay, provide Sage Pay with the TxID so that we can check the logs (if within 72 hours)
is the NotificationURL an http or https URL? consider html5 issues
if Sage Pay can't reach the NotificationURL, check that you have the ports 80 and 443 open. Have you received any attempts to the NotificationURL before?
check not a DNS issue
check your website is not spooling / not an issue with hosting company?
make sure Status=OK rather than Error or Invalid
Can you provide more information so we can help further?

Resources