Click here to Skip to main content
15,913,910 members
Please Sign up or sign in to vote.
1.33/5 (3 votes)
See more:
Hello friends.

I want to send an array value in the mail.
The mail is getting send properly but in spite of showing the contents of array it shows System.Array in the mail body.

Below is the code i am using

C#
string callname = objAlert.GetLargeCallName(lasttime, Convert.ToDateTime(CurrentTime), myXmlSetting.LargeCallSize);
string[] call = callname.Split('/');

string strmgs = "Dear user," + "\r\n\r\n" + "\t" + "This is an auto generated email notification from CallConfine voice recording system to notify the concerned person that the Engine is recording large sized voice file( " + myXmlSetting.LargeCallSize + " Mb) since past   " + myXmlSetting.LargeCallFrequencyDuration + " hrs.\nThese are the file name "+call+ "Kindly check." + "\r\n\r\n\t\t" + "\r\n";


hope you guys understand my problem

Thanks in advance.
Posted
Updated 30-Jan-12 23:17pm
v2
Comments
walterhevedeich 31-Jan-12 5:25am    
You can't concatenate strings to arrays directly. And what's the purpose of splitting the string to an array? For me, I can just concatenate callname to the strmgs object to fix this, unless you have other purpose on why you split the string. Try to describe your scenario a bit clearer.

C#
string strmgs = string.Format("Dear user," + "\r\n\r\n" + "\tThis is an auto generated email notification from CallConfine voice recording system to notify the concerned person that the Engine is recording large sized voice file({0} Mb) since past {1} hrs.\nThese are the file name {2}. Kindly check." + "\r\n\r\n\t\t" + "\r\n", myXmlSetting.LargeCallSize, myXmlSetting.LargeCallFrequencyDuration, GetFileNames(call) );

private static string GetFileNames(string[] call)
{
string fileNames = string.Empty;
foreach (string str in call)
{
 fileNames += str + Environment.NewLine;
}

return fileNames;
}
 
Share this answer
 
More simple:
C#
string call = callname.Replace("/", "\r\n");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900