Laravel not sending emails on Platform.sh to SendGrid - laravel

Im hosting a Laravel spark website on platform.sh. I have configured the environment variables within the platform.sh GUI to be what is suggested in their guides but for some reason SendGrid isn't picking up the emails.
I am using my SendGrid Log in details for username and password - I have also tried by using my API Keys.
There are no errors or anything and both SendGrid and Platform.sh are being useless saying they can't do or see anything, so im pretty lost as to where I go next. I have tried many various configuration options but none seem to have worked.
Here is the snippet of code to send the mailable in Laravel:
Mail::to($input['email'])->send(new BetaSignUp($referral, $referralFacebookUrl, $referralTwitterUrl));
Has anyone successfully got Laravel running on platform.sh, and sending emails via SMTP (SendGrid)
Thanks
EDIT
With the help of PSH i have run a python script they sent me to do a test on the container - this test was successful and I can see the email in SendGrid. Here is the test Script:
import smtplib
sender = 'info#smbstreams.live'
receivers = ['to-email#email.com']
message = """From: Deck Stream Team<info#smbstreams.live>
Reply-To: Deck Stream Team<deckstream#smbstreams.live>
To: To Person <to-email#email.com>
Subject: SMTP e-mail test
This is a test e-mail message.
"""
server = smtplib.SMTP_SSL('smtp.sendgrid.net', 465)
server.set_debuglevel(1)
server.login("****", "****")
server.sendmail(sender, receivers, message)

Have you follow this https://docs.platform.sh/development/email.html#enablingdisabling-email
Email support can be enabled/disabled per-environment. By default, it
is enabled on the master environment and disabled elsewhere. That can
be toggled in through the web UI or via the command line, like so:
platform environment:info enable_smtp true

Related

Laravel mailbox inbound parse sendgrid

So I'm trying to make my own inbox for emails using the followin packag beyondcode/laravel-mailbox
I installed the package on a blank project, in order to test it out.
I can send emails with the sendgrid API, so that's not a problem at all.
Now, I have some environment variables set;
MAILBOX_DRIVER=sendgrid
MAILBOX_HTTP_USERNAME=laravel-mailbox
MAILBOX_HTTP_PASSWORD=secret
The config just the same as given in the package.
In my AppServiceProvider, I have in the boot the following:
Mailbox::catchAll(static function(InboundEmail $email) {
// Handle the incoming email
Log::info('#-------------------------------------------------------------------------------------------#');
Log::info($email);
Log::info('#-------------------------------------------------------------------------------------------#');
});
But when I take a look in the logs, when I send an email to whatever#rallypodium.be, nothing hapens...
This is my DNS configuration:
And here is the inbound parse config on the sendgrid side:
What am I missing or doing wrong here? I looked at my access logs and not even a request is being made to the server from sendgrid...
So How can I make sure I can receive messages to whatever#mydomain.com?
Your DNS should also have a few CNAME records so that you can verify your domain with SendGrid.

Why I When I using mailgun for sending from yahoo mail or sending to yahoo mail it not works?

when i using gmail email it can be reset and set the from recipents
but when using yahoo mail the set from doent send and reset to yahoo address was error with
Expected response code 250 but got code "554", with message "554 Sandbox subdomains are for test purposes only. Please add your own domain or add the address to authorized recipients in Account Settings. "
Did you check out this page?
If this is the cause you could try sending an text-only e-mail for testing purposes, see if that does works.

Laravel - How Do You Check If Current E-Mail Configuration is Valid Without Sending an E-Mail?

I've written a custom provider that overwrites the e-mail configuration settings in mail.php with values populated from a database. I have a feature in my app that lets users tests the e-mail configuration entered into the system.
I can test whether current credentials are valid by calling Mail::send(). If the configuration isn't valid, the send() method will return a reason on why sending the e-mail failed.
Is there anyway for me to check configuration without actually sending an e-mail?
You can use Mail::fake(); that doesn't send the email.
In you /config/mail.php set email driver from smtp to log. I usually do it in .env
MAIL_DRIVER=log
Then send the mail as usual. You'll get a log with your email in it in /storage/logs/laravel.log This would be the easiest method. Further you can use services like mailtrap.io or mailthief

Laravel's Mail notification won't send, but Laravel's Mail::Raw will

I have configured my SMTP server correctly in Laravel's env file, and can successfully send an email using Mail::raw e.g.
Mail::raw("This is a test message", function ($message)
{
$message->from(env("MAIL_ORDER_ADDRESS"), 'Orders');
$message->to('user#example.com');
$message->subject('Test Message');
});
However, when I use a laravel 5.3 mail notification, no email is received (nor is an error generated). I have tested the same notification code locally using mail trap and the notifications work correctly.
I can't understand how if the mail server is working and can be used with Mail::raw, it doesn't automatically work with notifications when I have tested locally and confirm they are coded correctly.
Note: Using shared hosting on NameCheap.
Any ideas?
FIXED: It was because I had not configured "From" in config/mail.php and because the domains didn't match, it wasn't set.
The opposite situation is occurring for me. I have the MAIL_DRIVER=mail set within the .env file.
I have set MAIL_FROM_ADDRESS & MAIL_FROM_NAME within the .env file and viewed the app/config/mail.php
Mail::raw is sending out email correctly via the Postfix logs but any emails sent via the new Laravel 5.3 Notifications is not working. No errors or any information writing to the logs.
There appears to be some other issue occurring.
I had the same issue. During testing for Mail::raw, i had set MAIL_ENCRYPTION to empty.
When I set MAIL_ENCRYPTION=tls for notify email, it started working.

How can I configure Meteor to use Amazon SES when running on Heroku?

I would like to use the built in email methods that Meteor provides, but I need my app to run on Heroku and use the smtp endpoint of Amazon SES to transport my message.
I'm using the Meteorite build pack and the accounts-password package.
Follow instructions below to get meteor emails sending correctly from heroku using amazon ses
1) set up smtp access via aws console, get your smtp credentials
2) using a javascript console (chrome dev tools / firebug) run
encodeURIComponent("SES_SMTP_USERNAME")
encodeURIComponent("SES_SMTP_PASSWORD")
to encode the username/password for use in your smtp url
3) take resulting strings to build your smtp url like so
smtp://ENCODED_USER:ENCODED_PASS#SES_SMTP_URL:465
4) set the MAIL_URL variable to tell meteor to use this method for sending emails
heroku config:add MAIL_URL=YOUR_SMTP_URL
(do not surrond the url with qoutes)
5) set sender to be a SES verified sender within your meteor app via
Accounts.emailTemplates.from = "SENDER_NAME <SENDER_EMAIL>";
That will allow Meteor default email methods to function properly.
In addition to what you've suggested in your gist you could also use Meteor.http methods with SES API and send a POST/GET request.
Full API docs at http://docs.aws.amazon.com/ses/latest/DeveloperGuide/QueryInterface.Examples.html
Of course this is a manual solution, and wont use the built in meteor mail method. It can however be corrected by redefining the mail function via Email.send = function(...
UPDATE
You can also use the email-ses package on atmosphere
mrt add email-ses
More info here: https://atmospherejs.com/package/email-ses

Resources