Re: Split Function
- From: "Karl" <googlegroups@xxxxxxxxxxxxxxxx>
- Date: 14 Aug 2006 13:13:48 -0700
I take it you have another closing curly brace at the end of your code
as there appears to be one missing from here.
Also, what exactly is your error?
sck10 wrote:
Hello,
I have a list of email addresses that I need to send email to from the
website. I am trying to use the "Split" function to get all the To's and
then use the uBound function for the For-Loop limit:
I am trying to convert the following from vb to c#:
Dim SplitCatcher As Object
SplitCatcher = Split(To, ",")
Dim i As Integer
For i = 0 To UBound(SplitCatcher)
If Len(SplitCatcher(i)) > 0 Then objMM.To.Add(SplitCatcher(i))
Next
to
string[] SplitCatcher = Split(To, ",");
for (int i = 0; uBound(SplitCatcher); i++)
{
if (SplitCatcher[i].Length > 0) MM.To.Add(SplitCatcher[i]);
}
Mail Code
====================
public void SendWebMail(string From, string To, string Subject, string Body,
string Client)
{
//Build Email List
MailMessage MM = new MailMessage();
MailAddress AddrFrom = new MailAddress(From);
// build recipient list
//MailAddress AddrTo = new MailAddress(To);
string[] SplitCatcher = Split(To, ",");
for (int i = 0; uBound(SplitCatcher); i++)
{
if (SplitCatcher[i].Length > 0) MM.To.Add(SplitCatcher[i]);
}
MM.Subject = Subject;
MM.Body = Body;
SmtpClient scMail = new SmtpClient(Client);
scMail.Send(MM);
} //End void SendMail
.
- References:
- Split Function
- From: sck10
- Split Function
- Prev by Date: Collection properties in web controls
- Next by Date: RE: Split Function
- Previous by thread: Split Function
- Next by thread: RE: Split Function
- Index(es):
Relevant Pages
|