Solved

Send LN mail to multiple address from asp.net

Posted on 2010-11-26
13
858 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

705 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

17 Experts available now in Live!

Get 1:1 Help Now