Class 'DOMDocument' not found error in Ubuntu Laravel - laravel

env file parameters:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=<emailadress>
MAIL_PASSWORD=<password>
MAIL_ENCRYPTION=ssl
system Features:
PHP 7.4.33
Composer version 1.10.26
I am waiting mail in MailBox. But it is giving error.

Related

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.

Lumen mail driver is null issue

I am following this link https://lumen.laravel.com/docs/5.7/mail
here is my bootstrap/app.php code
$app->withFacades();
$app->withEloquent();
$app->register(\Illuminate\Mail\MailServiceProvider::class);
$app->configure('services');
$app->configure('mail');
$app->alias('mailer', Illuminate\Mail\Mailer::class);
$app->alias('mailer', Illuminate\Contracts\Mail\Mailer::class);
$app->alias('mailer', Illuminate\Contracts\Mail\MailQueue::class);
I run below code as well
composer require illuminate/mail
composer update
Here is my .env
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=abc#gmail.com
MAIL_PASSWORD=Abc#12345
MAIL_ENCRYPTION=tls
I installed fresh lumen and i am sure i did not missed anything.
I am getting this error
Unable to resolve NULL driver for [Illuminate\Mail\TransportManager].
The problem. you need to add config file for mail. (config/mail.php)
Just Copy Laravel mail.php config file to lumen root_dir/config/mail.php
Reference THIS LINK

send email in laravel 5.4

I Want to send reset password email in laravel,with default laravel auth
first login in mailtrap.io and get username and password,then edit env file such as this:
MAIL_DRIVER=sendmail
MAIL_HOST=mail.moallemmarket.com
MAIL_PORT=587
MAIL_USERNAME=username
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
and edit mail.php file such as env,Now I receive We have e-mailed your password reset link! message But don't receive any email in my inbox,I changed ports to 25 ans 2525 But result is same.How I can Solved this problem?
I had no problem coding
The problem with the non-activation of the email was in the cpanel that was solved by sending the ticket
With mailtrap, I use these vars in my .env file:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=username
MAIL_PASSWORD=password
MAIL_ENCRYPTION=null

Laravel with Postfix

I was using gsuite to send mail from laravel, config on .env was:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=account#gmail.com
MAIL_PASSWORD=password123
MAIL_ENCRYPTION=ssl
It is working ok, but now i installed postfix as a send-only to send newsletters and tested via command line like this:
echo "Teste message" | mail -s "Title Message" any#email.com
And it worked ok, but i cant figure on how to use it on laravel, what should be the configuration? I tried this:
MAIL_DRIVER=smtp
MAIL_HOST=localhost
MAIL_PORT=25
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
But it return:
Swift_TransportException
Expected response code 220 but got code "", with message ""

Laravel 5 send mail in contact form

I use Laravel 5.1 and want to send the admin of the page a mail with the content of a contact form.
In my .env file I added the following lines:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=admintest#gmail.com
MAIL_PASSWORD=adminpassword
MAIL_ENCRYPTION=tls
In my controller I have the following:
Mail::send('Site::email', ['contactObject' => $contactObject], function ($message) use ($contactObject) {
$message->from($contactObject->email, $contactObject->vorname)->subject('New contact!');
$message->to('admintest#gmail.com');
});
$contactObject == contains the form which was filled out in the form from the user
Desired result:
When admintest#gmail.com receive a email, the sender of the mail should be $contactObject->email
Actual result:
When admintest#gmail.com receive a email, the sender of the mail is admintest#gmail.com
Any ideas what goes wrong? Thank you
Try This:
In Live server you have no need to configure any type of mail service.
You have to just use this:
MAIL_DRIVER=mail
AND remove this code:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=admintest#gmail.com
MAIL_PASSWORD=adminpassword
MAIL_ENCRYPTION=tls
You have to just use in .env file:
MAIL_DRIVER=mail
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=xyz#gmail.com
MAIL_PASSWORD=yourpassword
MAIL_ENCRYPTION=tls
After change in .env file, restart service, or use command php artisan config:cache and php artisan config:clear.
Have you configured the global from address in the config?
Specifically here: https://github.com/laravel/laravel/blob/master/config/mail.php#L49
Chances are that you've set that and it's just using that, making these values blank should let you override it.
Failing that, because you're using Gmail to send an email to Gmail, it's likely not letting you spoof the from and is indeed a security feature on their end.

Resources