Jump to content

Newsletter with wireMailSMTP, array problem with multiple emails


FL0RIAN
 Share

Recommended Posts

I'm working on a newsletter solution with WireMailSMTP and this Newsletter Tutorial.
I only changed the lines 73 to 83 in newsletter.php, but there's a strange issue with the $subscribers array:

    $testMode = isset($_POST['test_email']) ? true : false;
    if ($testMode) {
        $subscribers = wire('input')->post('test_email');
        if (strpos($subscribers, ',') !== false) {
            $subscribers = explode(',', $subscribers);
        }
    } else {
        $subscribers = $pages->find('template=subscriber');
        $subscribers = $subscribers->explode('email');
    }
	if (is_array($subscribers)) {
        $subscribers = array_map('trim', $subscribers);
    }
	$mail = wireMail();
    $mail->sendSingle(true)->to('test@domain.de')->bcc($subscribers);
    $mail->from('xxx@domain.de');
    $mail->subject($newsletter->title);
    $mail->bodyHTML($html);

	$numSent = $mail->send();
    echo json_encode(count($subscribers));
    $this->halt();
The email is sent to test@domain.de but not to bcc $subscribers.
Errorlog: PHP Notice: Unknown: Invalid mailbox list: <> (errflg=3) in Unknown on line 0

I'm grateful for any advice.

Greetings
Florian

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...