PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Tue Jul 07, 2020 1:09 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Wed Aug 04, 2010 10:28 am 
Offline
Forum Newbie

Joined: Wed Feb 15, 2006 8:31 pm
Posts: 11
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?


Top
 Profile  
 
PostPosted: Wed Aug 04, 2010 2:30 pm 
Offline
Site Administrator
User avatar

Joined: Wed Aug 25, 2004 7:54 pm
Posts: 13592
Location: New York, NY, US
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.

_________________
(#10850)


Top
 Profile  
 
PostPosted: Wed Aug 04, 2010 4:01 pm 
Offline
Forum Newbie

Joined: Wed Feb 15, 2006 8:31 pm
Posts: 11
a little newb here, for that matter
...
no, i am using smpt...

and the following config:
Syntax: [ Download ] [ Hide ]
$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);
 


Top
 Profile  
 
PostPosted: Wed Aug 04, 2010 8:37 pm 
Offline
Forum Newbie

Joined: Wed Feb 15, 2006 8:31 pm
Posts: 11
resolved:
set up an array variable instead of a string.

Syntax: [ Download ] [ Hide ]
$var = array('a','b')
->setTo($var)
 

regards


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group