Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Send LN mail to multiple address from asp.net

Posted on 2010-11-26
13
Medium Priority
?
878 Views
Last Modified: 2013-12-18
I want to be able to send mail to more than one mail address from asp.net (vb code behind) application. I have mail addresses as TeboxBox.Text (four text box controls) and dont know how to add them to SendTo item in code.

Call doc.ReplaceItemValue("SendTo", Textbox1.Text.Trim)

Thanks.
0
Comment
Question by:kahvedzic
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
  • 3
13 Comments
 
LVL 22

Expert Comment

by:mbonaci
ID: 34217021
Simply create an array, fill it with elements of the Textbox1 and place it in the method call, instead of Textbox1.Text.Trim param.
0
 
LVL 1

Author Comment

by:kahvedzic
ID: 34217048
OK but how to separate addresses in array only with "," or ", " or ";" (without "" of course)?
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 34217511
I don't understand, how do you mean "separate adresses in array"?

You don't.
I mean, you separate them by assigning them to different array positions:

array(0) = "addr1"
array(1) = "addr2"
array(2) = "addr3"
0
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 
LVL 20

Expert Comment

by:BuggyCoder
ID: 34219619
if you have all the addresses in array, then do the following:-

string addList=String.join(",",yourarrref);
you will get comma separated address list in addlist variable.

here is how join works:-0
http://msdn.microsoft.com/en-us/library/57a79xd0.aspx

hope it helps
:-)
0
 
LVL 1

Author Comment

by:kahvedzic
ID: 34224898
This way if I want to send one mail to 4 people I have 4 mails in sent folder. This is not what I want, I want to send one mail to 4 people and in only one mail (like in Lotus Notes client in To text box it goes Person1@blabla.com, Person2@blabla.com, Person3@blabla.com etc....).
0
 
LVL 20

Expert Comment

by:BuggyCoder
ID: 34226363
In my example above, just copy the addlist string value in the to address field. If you assign comma separated list to the TO address field it will send one mail to all the 4 addresses and u have only 1 mail in ur sent items.
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 34228475
No, you don't send a String to SendTo field when you want multiple recipients, you send an array.

Have you tried that?

Can I ask where are you from? I mean, which country?
0
 
LVL 1

Author Comment

by:kahvedzic
ID: 34229959
This is what I code:

Dim slanje As New ArrayList()

slanje.Add(adresa.Text.Trim)
slanje.Add(Label1.Text.Trim)
slanje.Add(Label2.Text.Trim)

Call doc.ReplaceItemValue("SendTo", slanje)

and then got:

Unknown or unsupported object type in Vector
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Unknown or unsupported object type in Vector

Source Error:


Line 39:         doc = db.CreateDocument
Line 40:         Call doc.ReplaceItemValue("Form", "Memo")
Line 41:         Call doc.ReplaceItemValue("SendTo", slanje)
Line 42:         Call doc.ReplaceItemValue("CopyTo", cc.Text.Trim)
Line 43:         Call doc.ReplaceItemValue("Subject", subject.Text.Trim)
0
 
LVL 22

Accepted Solution

by:
mbonaci earned 2000 total points
ID: 34230088
Not a List, you need ordinary, simple, "non-object", array of strings.
ArrayList is List, not an array.

Can you write (in whatever language you're using, VB?):

Dim slanje(2) As String

slanje(0) = adresa.Text.Trim
slanje(1) = Label1.Text.Trim
slanje(2) = Label2.Text.Trim


No answer about the country you live in? Slanje is Croatian/Serbian word, right?
0
 
LVL 20

Expert Comment

by:BuggyCoder
ID: 34230105
Try This one out:-
i have replaced ','(comma) with ';' (semi-colon)

ArrayList ar = new ArrayList();
ar.Add("abc.com");
ar.Add("hello.com");
string[] arrStr=(string[])ar.ToArray(typeof(string));
string addList = String.Join(";", arrStr);

Call doc.ReplaceItemValue("SendTo", addList)

This is in C#, kindly get the idea!!!

0
 
LVL 1

Author Comment

by:kahvedzic
ID: 34230157
I live in B&H, yes its C/S word you were right. I will try this (and @BuggyCoder solution).
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 34230325
There's really no need to use ArrayList if you need to create array with fixed number of Strings - meaning names/addresses (at least in Java, that is).
That's just an overhead.

Lists are good when you:
 - don't know the size of the collection
 - need to do plenty of inserts, especially inserts at different positions
0
 
LVL 1

Author Comment

by:kahvedzic
ID: 34230568
Thanks mbonaci its working like a charm when I use Textbox.Text in string array. Just fine thanks once more neighbour ;)

Cheers.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question