Tôi muốn gửi tin nhắn nhóm bằng lưới gửi. nhóm của tôi có 100 members.When tôi gửi tin nhắn theo nhóm, từ 50 đến 80 tin nhắn được gửi và sau đó nó cho thấy một trang trống như:Gửi tin nhắn nhóm bằng lưới gửi, cung cấp cho 500 Lỗi Máy chủ Nội bộ
NetworkError: 500 Internal Server Error
Mã của tôi là,
set_time_limit (0);
$usernames = 'username'; // Must be changed to your username
$passwords = 'password'; // Must be changed to your password
// Create new swift connection and authenticate
$transport = Swift_SmtpTransport::newInstance('smtp.sendgrid.net', 25);
$transport ->setUsername($usernames);
$transport ->setPassword($passwords);
$swift = Swift_Mailer::newInstance($transport);
// Create a message (subject)
$message = new Swift_Message($subject);
// add SMTPAPI header to the message
$headers = $message->getHeaders();
$headers->addTextHeader('X-SMTPAPI', $hdr->asJSON());
// attach the body of the email
$message->setFrom($from);
$message->setBody($html, 'text/html');
$message->setTo($to);
$message->addPart($text, 'text/plain');
if ($recipients = $swift->send($message,$failures)){
$message= 'Message sent';
}else{
$message= "Something went wrong - message not sent, please try later";
}
asJSON:
{
"to": [
""
],
"sub": {
"-name-": [
"anu"
],
"-time-": [
"12 PM"
]
},
"category": "initial",
"filters": {
"footer": {
"settings": {
"enable": 1,
"text\/plain": "Thank you "
}
}
}
}
Bạn có thể cung cấp cho chúng tôi đầu ra của 'asJSON' không? Nó sẽ giúp gỡ lỗi. – Swift
@Swift output của asJSON là \t {"tới": [""], "phụ": {"-name-": ["anu"], "-time-": ["12 PM"]}, " danh mục ":" ban đầu "," bộ lọc ": {" footer ": {" settings ": {" enable ": 1," text \/plain ":" Thank you "}}}} –
Trông giống như' to' tham số là vấn đề. Không giống như '$ to' được đặt trong mã của bạn. – Swift