S
sck10
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.Length > 0) MM.To.Add(SplitCatcher);
}
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.Length > 0) MM.To.Add(SplitCatcher);
}
MM.Subject = Subject;
MM.Body = Body;
SmtpClient scMail = new SmtpClient(Client);
scMail.Send(MM);
} //End void SendMail
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.Length > 0) MM.To.Add(SplitCatcher);
}
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.Length > 0) MM.To.Add(SplitCatcher);
}
MM.Subject = Subject;
MM.Body = Body;
SmtpClient scMail = new SmtpClient(Client);
scMail.Send(MM);
} //End void SendMail