Connecting Laravel to iRedMail on separate server - laravel

I have set up my iredmail server at mail.rys.com (in this example ip 45.65.36.114). i have a website running laravel at rys.com. i also have installed let's encrypt - with separate instances on each server. i am able to send emails and add accounts fine via the provided email programs, but i need laravel to generate these and have had difficulty getting this to validate
i have tried a number of examples but have not had success. i haven't changed anything on the iredmail side and i can send mail from the admin#rys.com account but not via laravel
any help would be greatly appreciated.
Regards,
Peter
Config:
MAIL_DRIVER=smtp
MAIL_HOST=45.65.36.114
MAIL_PORT=587
MAIL_USERNAME=admin
MAIL_PASSWORD=xxxxx
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=admin#rys.com
MAIL_FROM_NAME="admin#rys.com"
Result:
Swift_TransportException (530)
Expected response code 250 but got code "530", with message "530 5.7.0 Must issue a STARTTLS command first "
Config:
MAIL_DRIVER=smtp
MAIL_HOST=45.65.36.114
MAIL_PORT=587
MAIL_USERNAME=admin
MAIL_PASSWORD=xxxxx
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=admin#rys.com
MAIL_FROM_NAME="admin#rys.com"
Result:
stream_socket_enable_crypto(): Peer certificate CN=mail.rys.com' did not match expected CN=45.65.36.114'
Config:
MAIL_DRIVER=sendmail
MAIL_HOST=45.65.36.114
MAIL_PORT=587
MAIL_USERNAME=admin
MAIL_PASSWORD=xxxxx
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=admin#rys.com
MAIL_FROM_NAME="admin#rys.com"
Result:
Swift_TransportException
Expected response code 220 but got an empty response
Config:
MAIL_DRIVER=smtp
MAIL_HOST=45.65.36.114
MAIL_PORT=80
MAIL_USERNAME=admin
MAIL_PASSWORD=xxxxx
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=admin#rys.com
MAIL_FROM_NAME="admin#rys.com"
Result:
Connection to 45.65.36.114:80 Timed Out

This was solved in a similar by adding what's below to the mail config. Answer's towards the bottom but it got the job done in Laravel 6
how to fix stream_socket_enable_crypto(): SSL operation failed with code 1
'stream' => [
'ssl' => [
'allow_self_signed' => true,
'verify_peer' => false,
'verify_peer_name' => false,
],
],

Related

Expected response code 250 but got code "550", with message "550-Requested action not taken: mailbox unavailable 550 Sender address has null MX

P.S. I am doing all of this testing on my local machine.I have tested my smtp settings with this online website https://www.smtper.net/. Each one of below services are sending the emails.
I am trying to setup email confirmation system for my Laravel application and keep on getting this error with email created through cpanel.
I have tried using Gmail/mailtrap/mailosaur for testing with these settings and everything was working fine:
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=email#gmail.com
MAIL_PASSWORD='password'
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=email#gmail.com
MAIL_FROM_NAME="${APP_NAME}"
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=ab723b95067210
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
MAIL_MAILER=smtp
MAIL_HOST=mailosaur.net
MAIL_PORT=2525
MAIL_USERNAME=hgyqqqgn#mailosaur.net
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
MAIL_FROM_NAME="${APP_NAME}"
but now when I am using my custom email i am getting this error in my logs file:
[2021-12-26 09:17:53] local.ERROR: Expected response code 250 but got code "550", with message "550-Requested action not taken: mailbox unavailable
550 Sender address has null MX
" {"exception":"[object] (Swift_TransportException(code: 550): Expected response code 250 but got code "550", with message "550-Requested action not taken: mailbox unavailable
550 Sender address has null MX
MAIL_MAILER=smtp
MAIL_HOST=smtp.ionos.com
MAIL_PORT=587
MAIL_USERNAME=noreply#domain.co.uk
MAIL_PASSWORD='password'
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=noreply#domain.co.uk
MAIL_FROM_NAME="${APP_NAME}"
"mailbox unavailable 550 Sender address has null MX".
It seems your smtp server can't find the IP address of the receiving mail server.
Are you sending to a valid email address?
Have you set up a DNS MX record?
This configuration is working well on my environment. Please try like this.
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=<your_username_goes_here>
MAIL_PASSWORD=<your_password_goes_here>
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=<your_email_goes_here>
MAIL_FROM_NAME="${APP_NAME}"`
Make sure that the sender email is valid. By that I mean if the provider of your sender email exist.
Example of invalide email: user#exemple.com

Emails sent using SMTP Gmail don't get delivered

I'm trying to send mails from my webserver using Laravel 6 like this:
Mail::send('feedback', ['email' => $email, 'text' => $text], function($message) use ($receiver)
{
$message->to($receiver, 'The receiver')->subject('New Feedback');
});
I added my login information into my .env file according to this page from google:
https://support.google.com/mail/answer/7126229?hl=de
my .env file:
MAIL_DRIVER=sendmail
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=xxxx#gmail.com
MAIL_PASSWORD=my_gmail_login_password
MAIL_ENCRYPTION=tls
but my mails don't get sent/delivered. I don't get any error message or anything logged. Everything seems to be working, but for some reason they don't get delivered.
I tried it with enabling insecure apps in my gmail settings and using my gmail password and also with creating an app password and using the app password. Both options didn't work.
Does someone have an idea what I'm doing wrong?
Try changing .env variables as below:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=username
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
or
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=username
MAIL_PASSWORD=password
MAIL_ENCRYPTION=ssl
You should set the .env attribute as below
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=username
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
Give it a try.

Swift_TransportException Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required "

I am new to Laravel and looking to enhance my skills in using Laravel framework 5.4. But I don't know what to do when I encounter this error: 1/1) Swift_TransportException Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required Is it .
make sure that you are using the mail credential in .env file. i think you try to send mail without using the mail credentials.so,
create credentials on sendgrid or any mail service for send mail and put these credentials in .env file.
MAIL_DRIVER=smtp
MAIL_HOST=smtp.sendgrid.net
MAIL_PORT=587
MAIL_USERNAME=your credentials username
MAIL_PASSWORD=your secret key
MAIL_ENCRYPTION=tls
replace this
'username' => env('ivanedu947#gmail.com'),
'password' => env('password'),
to this
'username' => env('MAIL_USERNAME','miemail#gmail.com'),
'password' => env('MAIL_PASSWORD','password'),
and on php line comand key
php artisan config:cache
and its must be works

Laravel Failed to authenticate on SMTP server with username "xxxxxxxx" using 2 possible authenticators

I'm trying the reset password email controller in Laravel.
I change my MAIL config in .env file like this:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.aruba.it
MAIL_PORT=465
MAIL_USERNAME=xxxxxxxxxxxx
MAIL_PASSWORD=xxxxxxxxxxxx
MAIL_ENCRYPTION=SSL
I got this error:
Swift_TransportException
Failed to authenticate on SMTP server with username
"xxxxxxxxxxxx" using 2 possible authenticators.
Authenticator LOGIN returned Expected response code 235 but got code
"535", with message "535 5.7.0 ...authentication rejected ".
Authenticator PLAIN returned Expected response code 235 but got code
"535", with message "535 5.7.0 ...authentication rejected
How can I solve it ?
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=<mailtrap username>
MAIL_PASSWORD=<mailtrap passsword>
MAIL_ENCRYPTION=SSL
signup https://mailtrap.io after signin they provide demo inbox then click on demo inbox. right hand side you get your username & password. just copy and paste
MAIL_DRIVER=smtp
MAIL_HOST=smtp.aruba.it
MAIL_PORT=465 or 25
MAIL_USERNAME=xxxxxxxxxxxx
MAIL_PASSWORD=xxxxxxxxxxxx //in your aruba account. aren't they provided any password like mailtrap.
MAIL_ENCRYPTION=SSL ot tls
i am not sure about this but you can try once

Error occurring in sending mail for Forget password

I have set up laravel 5.6 on server. When I try to use Forget Password, I am gettting error after enter email id:
Class Swift_AddressEncoder_IdnAddressEncoder does not exist
actually, it was working find two days before but now i dont know what happen...I have done thing in it.
below connection in .env:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.sendgrid.net
MAIL_PORT=587
MAIL_USERNAME=apikey
MAIL_PASSWORD=SG.EcuUbtbhSbq1IAh**1tPQg.uFah8Jw**7lh10wGpA_CPU01ySmAC26HFylz_BFI
MAIL_ENCRYPTION=tls
MAIL_FROM_NAME="Your Trade Log"
MAIL_FROM_ADDRESS=support#y**r**r*a**.com
this is live link for Reset Password: YourTradeLog

Resources