尝试在实时服务器

时间:2018-03-21 04:32:45

标签: php laravel xampp

我想在我的Laravel项目中进行在线预约。为此,我为约会生成了一个邮件功能。这个邮件功能在本地xammp服务器上工作....但不在实时服务器中。

尝试发送邮件时出现此错误

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文件错误

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)

控制器内的邮件功能代码

public function sendMail($emailDataArray)
{
 \Mail::send('frontend.mail.demo', $emailDataArray, function($message) use ($emailDataArray)
  {
    $message->to($emailDataArray['patient_email'], 'Test')->subject('APPOINTMENT');
  });
}

以下是我的.env文件的MAIL部分

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=shetshuvro@gmail.com
MAIL_PASSWORD="app generated password"
MAIL_ENCRYPTION=tls

实时服务器需要进行哪些更改,实际上是什么问题?

1 个答案:

答案 0 :(得分:1)

解决了这个问题。

只需将<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.19.1</version> <configuration> <trimStackTrace>false</trimStackTrace> <includes> <include>**/*Test.class</include> </includes> </configuration> </plugin> 文件中的驱动程序名称从.env更改为smtp

sendmail

参考[Using gmail smtp via Laravel: Connection could not be established with host smtp.gmail.com [Connection timed out #110]