Reputation: 433
I want to make an online appointment in my Laravel project. For that I have generated a mail function for the appointment.This mail function is working in xammp server locally....But not in live server.
Got this error while trying to send mail
GET http://sencare.com.bd/sencare.com.bd/confirm_appointment?patient_name=test&patient_number=01654&patient_email=rahmanarafat13%40gmail.com&patient_age=8&patient_gender=1&service_id=6&schedule_time_id=1&date=+2018-03-27 500 (Internal Server Error)
send @ jquery-2.1.4.min.js:4
ajax @ jquery-2.1.4.min.js:4
n.(anonymous function) @ jquery-2.1.4.min.js:4
(anonymous) @ (index):2029
dispatch @ jquery-2.1.4.min.js:3
r.handle @ jquery-2.1.4.min.js:3
log
file error
ERROR: Connection could not be established with host mail.mailhost.com [php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution #0] {"exception":"[object] (Swift_TransportException(code: 0): Connection could not be established with host mail.mailhost.com [php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution #0] at /home2/sencarec/public_html/sencare.com.bd/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:269)
Mail function code inside controller
public function sendMail($emailDataArray)
{
\Mail::send('frontend.mail.demo', $emailDataArray, function($message) use ($emailDataArray)
{
$message->to($emailDataArray['patient_email'], 'Test')->subject('APPOINTMENT');
});
}
Here is my .env
file's MAIL
part
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD="app generated password"
MAIL_ENCRYPTION=tls
Anything change needed for live server or what's the problem actually ?
Upvotes: 0
Views: 1484
Reputation: 433
Solved this problem.
Just change the driver name in .env
file from smtp
to sendmail
'driver' => 'sendmail',
Upvotes: 1