473,386 Members | 1,708 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,386 software developers and data experts.

Simple Loop

147 100+
Hi

I'm trying to make a simple loop to work within an email app.

All I would like to do is fill in the BCC field, but the information is created dynamically on the previous page on my website.

So information passed looks like
Request.Form("CompanyEmail") which displays the result email1.com, email2.com

All I am trying to do is put the result into the MyMail.BCC field.

My Code:

Expand|Select|Wrap|Line Numbers
  1. dim varE, strItem
  2. varE = Request.Form("CompanyEmail")
  3. varE= Replace(varE," ","")
  4. varE = Split(varE,",")
  5.     for each strItem in varE
  6.                          Response.Write(strItem)
  7.              MyMail.BCC = MyMail.BCC + strItem
  8.     Next
  9. Response.Write(MyMail.BCC)
  10. MyMail.BCC = Replace(MyMail.BCC," ","""")    
  11. Response.Write(MyMail.BCC)
  12.  
Line 6 displays the result: email1.com email2.com
Line 9 displays the result: "email1.com email2.com" (please note the quote marks are created by the progam and not by me)
Line 11 displays the result "email1.com""email2.com "" , """ <">, "email1.com" error '8004020f'

I have no idea where the extra symbols come from on Line11

Because these 2 emails have to go into the BCC field, I have to have them spereated by ""; (eg "email1"; "email2"; (hence line 10)).

Any one got a better idea on how to do this?

Thanks
Jun 25 '09 #1
4 1886
GazMathias
228 Expert 128KB
Hi there,

Try this:

Expand|Select|Wrap|Line Numbers
  1. dim varE, strItem, BCC, tmp
  2. varE = Request.Form("CompanyEmail")
  3. varE= Replace(varE," ","")
  4. varE = Split(varE,",")
  5.     for each strItem in varE
  6.          tmp = chr(34) & strItem & chr(34) & "; "
  7.          BCC = BCC & tmp
  8.     Next
  9.  
  10.     BCC = left(BCC,len(BCC)-2)
  11.  
  12. Response.Write(BCC)
  13. MyMail.BCC = BCC
  14.  
It outputs this:

"email1.com"; "email2.com"; "email3.com"

Gaz
Jun 26 '09 #2
DaveRook
147 100+
Hi Gaz

It worked perfectly, thank you for that. If I understand correctly, I had to create the finished string and then send it to the MyMail.CC first instead of trying to build the MyMail.CC on the fly?

Thank you for your help

Dave
Jun 26 '09 #3
GazMathias
228 Expert 128KB
If I understand correctly, I had to create the finished string and then send it to the MyMail.CC first instead of trying to build the MyMail.CC on the fly
I guess it is just a matter of preference.

Gaz.
Jun 26 '09 #4
DaveRook
147 100+
You're way does seem more logical, although I'm sure it is just what 'one' preferrs!

Thank you again
Jun 26 '09 #5

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

Similar topics

6
by: Arthur J. O'Dwyer | last post by:
I was paging through Coplien's book "Advanced C++ Programming Styles and Idioms" this afternoon and found some code that looked something like void sort(vector<foo> a) { int flip; do { for...
22
by: lokman | last post by:
Hi, In the following code, can someone tell me the difference between *p++ and p++ ? I can see both achieve the same result. Thanks a lot !
1
by: Brian Henry | last post by:
Hello, I was tring to learn socket's (being i never used them before) and have a simple question. I want to create a listner that will get any data recieved and print it out. I've been able to...
14
by: dba_222 | last post by:
Dear experts, Again, sorry to bother you again with such a seemingly dumb question, but I'm having some really mysterious results here. ie. Create procedure the_test As
6
by: porky008 | last post by:
I need to modify the following program so that it uses a class to store and retrieve the employee's name, the hourly rate, and the number of hours worked. Use a constructor to initialize the...
23
by: AndersWang | last post by:
Hi, dose anybody here explain to me why memset would be faster than a simple loop. I doubt about it! In an int array scenario: int array; for(int i=0;i<10;i++) //ten loops
0
by: rich | last post by:
Hi all, I have a fairly complex "feed" application that recieves messages from an external user-supplied API via a callback function, and attempts to forward these messages to another...
30
by: galiorenye | last post by:
Hi, Given this code: A** ppA = new A*; A *pA = NULL; for(int i = 0; i < 10; ++i) { pA = ppA; //do something with pA
1
by: Jon Slaughter | last post by:
Say I have two nested foreach loops, is there any simple way of continuing out of the outter most loop depending on what happens in the inner most? e.g., foreach(int i in I) { foreach(int j...
1
by: jerry | last post by:
i have written a simple phonebook program,i'll show you some of the codes,the program's head file is member.h . i suppose the head file works well.so i don't post it. here's the clips of main...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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,...

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.