473,569 Members | 2,703 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

storing email bcc: adresses from query result(s)

3 New Member
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(S ERVER, LOGIN, PASS)
or die("Couldn't connect to SQL Server on SERVER");
$database = mssql_select_db (DBNAME,$connec t)
or die("Couldn't open database $DBNAME");
$query = "SELECT Distinct ClcEmail
FROM ClientContact
WHERE Deleted = 0 AND ClcEmail IS NOT NULL";
$result = mssql_query($qu ery);
$row = mssql_fetch_arr ay($result);
while($row = mssql_fetch_arr ay($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 1764
ronverdonk
4,258 Recognized Expert Specialist
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 Recognized Expert Specialist
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 New Member
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 Recognized Expert Specialist
When you want to make an address string like "john@abc.com;p ete@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 New Member
Thank you for your help.
Apr 7 '08 #6
ronverdonk
4,258 Recognized Expert Specialist
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
4151
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 addresses to which I would like to send a mass email occasionally. The group will never be much larger than 500 email addresses and will occasionally...
0
1603
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
12652
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, in data * Module smtplib, line 312, in send * Module socket, line 1, in sendall
2
2758
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 run a macro which runs a select query which strips out and exports a list of their e-mail addresses ( separated by commas) into a text file. I...
1
399
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 and Outlook find perfectly acceptable. Since the code I'm using is currently ugly and embedded, before I trim it down for posting could anyone...
7
9328
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 removed the "rcpts" field from the bcc option of the SendObject tag - OK (3) I tried inserting the DoCmd.SendObject line into the loop and used the...
2
1943
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) causes the email not to be sent. Email server software is Exchange SP2, but other users (including our own test site) use the same without any...
11
3490
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 programs capabilities. Searching this forum I did not find any related information so if I have chosen poorly, I would appreciate a suggestion of a more...
7
4695
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 ressults pop up with a message saying Object Required. Thoughts? Private Sub BCCMail_Click()
0
7612
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7922
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8119
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7668
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5218
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2111
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.