Solved

Send LN mail to multiple address from asp.net

Posted on 2010-11-26
13
859 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
  • 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
 
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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 …
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

895 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now