How to post multiple emails from textbox to the swiftmailer?

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Wed Nov 13, 2013 1:31 pm

How to post multiple emails from textbox to the swiftmailer?

Postby atlantis » Wed Nov 13, 2013 1:39 pm

Code: Select all

I want to create in html textbox named b and php code which gets email from it with $_POST. Unfortunately as setBcc is used as an array and I cannot convince php to get emails from this textbox.

This is the code of php:

[code]    <?php
    require_once 'lib/swift_required.php';
    $transport = Swift_MailTransport::newInstance();
    $message = Swift_Message::newInstance();
    "" => "Nightbitch"
    $message->setBcc(array('', '', ''));
    $tekst = 'OK';
    $message->setSubject("Funkcjonalności: 3 kategorie, zasady komentarzy");
    $message->setFrom("", "");
    // Send the email
    $mailer = Swift_Mailer::newInstance($transport);

and this is the line I want to setup with $_POST:
    $message->setBcc(array('', '', ''));[/code]

Of course I paste email in the textbox with all necessary letters like inside the array.

All I have is this error after replacing emails in an array with $_POST:
    Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/a7018175/public_html/mail2.php on line 10[/code]

I was using mail() function earlier, but it didn't send alot of emails to my newsletter users ... so I decided to switch to this class. Any idea how to $_POST emails from textarea in my case, so that swiftmailer could send message to all? I storage emails as Bcc field instead of always uploading changed file with new emails?

Code: Select all

$message->setBcc(array('', '', ''));


Thanks alot. This is the first time I learn php, something I couldn't have done without you.

Return to “PHP coding => General”

Who is online

Users browsing this forum: wtolentino and 6 guests