basically that what i wanna do but i can't seem to do it nor have i found anyone that tried it before.
basically im receiving a string with emails as so
john@gmail.com, maria@gmail, etc@gmail.com
and i want to use those emails and place them in the setTo field but i can't
ive tried creating a string with each email delimited with ', like
'john@gmail.com', 'maria@gmail', 'etc@gmail.com'
placing it in a variable and setting that variable in the setTo field but that fails.
so, how would i go about and doing it?
how to setup dynamic email string for setTo
Moderators: Chris Corbyn, General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: how to setup dynamic email string for setTo
I assume you are using the mail() function? It should work with just a comma between email addresses.
Have you read this page carefully:
http://www.php.net/manual/en/function.mail.php
It gives many good examples.
Have you read this page carefully:
http://www.php.net/manual/en/function.mail.php
It gives many good examples.
(#10850)
Re: how to setup dynamic email string for setTo
a little newb here, for that matter
...
no, i am using smpt...
and the following config:
...
no, i am using smpt...
and the following config:
Code: Select all
$transport = Swift_SmtpTransport::newInstance($setting_smtp_email['smtp_host'], $setting_smtp_email['smtp_port'],'ssl')
->setUsername($setting_smtp_email['smtp_user'])
->setPassword($setting_smtp_email['smtp_pass'])
;
$mailMessage = Swift_Message::newInstance()
->setSubject($subject)
->setFrom(array($setting['setting_email_fromemail'] => $setting['setting_email_fromname']))
->setSender(array($setting['setting_email_fromemail']))
->setTo(array($recipient_email)) /* it's this guy that i haven't figured out how to use when setting more than one emails */
->setBody($message, 'text/html')
->addPart($textPlain_message, 'text/plain')
;
$result = $mailer->batchSend($mailMessage);
Re: how to setup dynamic email string for setTo
resolved:
set up an array variable instead of a string.
regards
set up an array variable instead of a string.
Code: Select all
$var = array('a','b')
->setTo($var)