Fix CyberMail from field — use separate from/from_name fields (API rejects Name <email> format)

This commit is contained in:
2026-06-14 15:40:35 +00:00
parent 66cbd3f0d3
commit 602bc77cdd
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -60,7 +60,8 @@ class Email {
// Strip internal-only keys that are not CyberMail API fields
$apiOptions = array_diff_key($options, array_flip(['metadata']));
$payload = array_merge([
'from' => $this->fromName . ' <' . $this->fromEmail . '>',
'from' => $this->fromEmail,
'from_name' => $this->fromName,
'to' => $to,
'subject' => $subject,
'html' => $html,
+1 -1
View File
@@ -336,7 +336,7 @@ function sendEmail($to, $subject, $htmlContent, $textContent = '') {
error_log('[TJJ sendEmail] CYBERMAIL_API_KEY not configured');
return false;
}
$payload = ['from' => $fromName . ' <' . $from . '>', 'to' => $to, 'subject' => $subject, 'html' => $htmlContent];
$payload = ['from' => $from, 'from_name' => $fromName, 'to' => $to, 'subject' => $subject, 'html' => $htmlContent];
if ($textContent) $payload['text'] = $textContent;
$ch = curl_init('https://platform.cyberpersons.com/email/v1/send');
curl_setopt_array($ch, [