473,405 Members | 2,415 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

storing email bcc: adresses from query result(s)

3
I have a php page that pulls email addresses from a MSSQL database. I am trying to insert these addresses into the BCC: Outlook via a link.

my query is as follows:[php]$connect = mssql_connect(SERVER, LOGIN, PASS)
or die("Couldn't connect to SQL Server on SERVER");
$database = mssql_select_db(DBNAME,$connect)
or die("Couldn't open database $DBNAME");
$query = "SELECT Distinct ClcEmail
FROM ClientContact
WHERE Deleted = 0 AND ClcEmail IS NOT NULL";
$result = mssql_query($query);
$row = mssql_fetch_array($result);
while($row = mssql_fetch_array($result))
{
echo $row["ClcEmail"] . "; ";
}[/php]this lists all of the email addresses i want (about 700) and places a semi-colon and space between them. Any time I try to place this in an email link, it shows only 1 email address or sometimes none.

Thanks
Apr 4 '08 #1
6 1755
ronverdonk
4,258 Expert 4TB
Welcome to Bytes!

Please enclose your posted code in [code] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use [code] tags in future.

MODERATOR
Apr 4 '08 #2
ronverdonk
4,258 Expert 4TB
But you do not show HOW you put these addresses inn the email link via PHP. Show that code (and show it within the appropriate code tags).

Ronald
Apr 4 '08 #3
ej20
3
Expand|Select|Wrap|Line Numbers
  1.     require_once('../../inc/inc.php');
  2.     $connect = mssql_connect(SERVER, LOGIN, PASS)
  3.     or die("Couldn't connect to SQL Server on SERVER"); 
  4.     $database = mssql_select_db(DBNAME,$connect)
  5.     or die("Couldn't open database DBNAME");
  6.     $query = "SELECT Distinct ClcEmail
  7.     FROM ClientContact 
  8.     WHERE Deleted = 0 AND ClcEmail IS NOT NULL"; 
  9.     $result = mssql_query($query);
  10.     $row = mssql_fetch_array($result);
  11.     while($row = mssql_fetch_array($result))
  12. {
  13.   $address = $row["ClcEmail"] . "; ";
  14. }    
  15.  
and then my html looks like this..
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <a href="mailto:<?PHP echo $address?>.....</html>
I am trying first to only use the To:
This produces one email and it is the last one from my query.
Sorry for not reading the posting guidlines. hope its right now.
Apr 4 '08 #4
ronverdonk
4,258 Expert 4TB
When you want to make an address string like "john@abc.com;pete@def.uk..." etc. you must concatenate each result from the db row to the original string, like this[php]$address .= $row["ClcEmail"] . "; ";[/php]The way you do it now you continuously replace the string in $address with a new value.

Ronald
Apr 4 '08 #5
ej20
3
Thank you for your help.
Apr 7 '08 #6
ronverdonk
4,258 Expert 4TB
You are welcome. See you next time here.

Ronald
Apr 7 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Jeffrey Silverman | last post by:
Hi, all. Sorry, first off, for the kidna weird selection of crossposted groups, but this question touches on aspects of discussion in each of the groups. So I have a group of around 500 email...
0
by: maceo | last post by:
I have some code that extracts the data from a table and performs a calculation (total time) on one of the columns. Here is the code: <?php /* Database connection */
5
by: morphex | last post by:
Hi, I have an email that's in the utf-8 encoding, and I'm getting this error message when I try to send it using smtplib: * Module smtplib, line 688, in sendmail * Module smtplib, line 485,...
2
by: Tomdhu | last post by:
I've got a Contacts & Events database in Access 2K where contacts attend various events. At present, where I want to group e-mail all the attendees who are going to attend a particular event, I...
1
by: Steve Holden | last post by:
I'm having some trouble getting attachments right for all recipients, and it seems like Apple's mail.app is the pickiest client at the moment. It doesn't handle attachments that both Thunderbird...
7
by: captainmorgan | last post by:
Below is the code I'm trying to use to create a blank email with the bcc list populated from a query. (1) I have tested the codes output of the "rcpts" field, and counted it as well - OK (2) I've...
2
by: =?Utf-8?B?cXVpbGtpbg==?= | last post by:
Hi We are using system.web.mail with .Net 1.1 (.Net 2.00 under development) and some of our users are reporting that having multiple names in the 'to' field for sending emails (using smtpmail)...
11
by: Ed Bitzer | last post by:
I have been able using the namespace System.Web.Mail and its method Smtp.mail.send to mail simple text messages to a small group within our 55 and older community. I need help expanding the...
7
by: micarl | last post by:
I'm trying to create a new email message from Outlook based on a query called Q_Email with the BCC field populated with the email address field in the query. When i run this code, the query...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.