Laravel mailbox inbound parse sendgrid - laravel

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.

Related

I got this error when i shoot the mail through mailgun.org in laravel8

Expected response code 354 but got code "421", with message "421 Domain sandbox4412497ba418406ba96c4a5332029424.mailgun.org is not allowed to send: Sandbox subdomains are for test purposes only. Please add your own domain or add the address to authorized recipients in Account Settings.
Like the message says you are using the test domain in mailgun.com. When using test domains you must add email addresses that are allowed to receive emails.
You can go to domain settings in mailgun add add recipient address to "Authorized Recipients".

SendGrid: connect to correct email api credentials

How to check if you are connected to the right SendGrid email api credentials in Laravel?
Make log files for your endpoints of the API to check each response especially when errors occur.

Laravel not sending emails on Platform.sh to SendGrid

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

Laravel mail on shared hosting

I've a form contact on my website and I want the form to be sent via email when submitted.
I've tried it in xampp and it's working fine.
On shared hosting, it does not work.
I'm using my own custom domain smtp.
Someone can explain me why it's not working ?
Your shared hosting probably blocks outgoing SMTP connections. Many hosting providers do that to prevent spam. You can try using a HTTP/WEB API instead of SMTP to send email.
Some email APIs like Flute Mail allow you to set up an HTTP API connection which can immediately forward the request through your "custom domain smtp" server. So you can keep using your custom domain email server, but get an API for it.
Otherwise you'll have to set up a Web API yourself with an open source tool like Postal.
In your laravel .env file if add following parameters mentioned below and create a e-mail on your shared hosting and add username, password and host of your hosting.
MAIL_DRIVER=smtp
MAIL_HOST=shared_host_name
MAIL_PORT=587
MAIL_USERNAME=mail#sharedhost.com
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
I suppose then it would work fine.

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

Resources