2016-10-30 60 views
0

我使用下面的代碼從我的註冊表發送並通過電子郵件發送給用戶,它可以工作,但會降低我的註冊頁面。如果我點擊註冊與代碼巴姆完成。但如果我有它的地方,它需要一段時間的註冊完成。我正在使用php7有沒有一種方法來加速?Sendmail郵件執行緩慢或差

$from = "Mysite <[email protected]>"; 
$to = $email; 
    $subject = "Registration"; 
    $body_message = "Hello!\n\n\n\nThank you for registering. \n\nYou must verify the email address associated with your account. 
    \n\n\nThis message was sent from an unmonitored account. Any responses will not be read.\nIf you have any questions or concerns, please contact [email protected]"; 
    $headers = "From: $from\nReply-To: $from\nContent-Type: text/plain"; 

    mb_send_mail($email, $subject, $body_message, $headers); 

回答

1

通過SMTP直接發送電子郵件時,性能會有所不同,並且是不可預測的。大多數體系結構都會使用隊列和工作任務將其與用戶體驗或第三方服務(如SendGrid)分離,這將爲您做到這一點,並提供其他花招和哨音。