Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

How to Incorporate Email Send into Current Coding

$
0
0

I want to use the send email method listed as the lastmethod in this code below.  But I am unable to discover how to have the body of the email display a list of all the students that were processed.  Can someone help please?

public static string GetStudentInfo()
{
	//Connection to SQL
	//Return list of data       
	//Storing list of data
	for (int q = residentName.GetLowerBound(0); q <= residentName.PgName.GetUpperBound(0); q++)
	{
					return residentName[q];
	}
}
public static void ProcessHousingInfo()
{
	GetStudentInfo()
	try
	{
					for (int q = residentName.GetLowerBound(0); q <= residentName.PgName.GetUpperBound(0); q++)
					{
									PrintHousingAssignment();
									PrintHousingRoomate();
									PrintBillingInvoice();
					}
					//I want to generate in the body of the ReadyEmail() all of the
					//Student Names that are returned and processed in my GetStudentInfo
	}
	catch
	{
	}
}
public static string Email()
{
	try
	{
		return Global.Variables.GlobalVariables.PgName[q];
		Outlook.Application oApp = new Outlook.Application();
		Outlook.MailItem oMsg = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);

		oMsg.HTMLBody = "Hello";
		oMsg.Subject = "Re";
		// Add a recipient.
		Outlook.Recipients oRecips = (Outlook.Recipients)oMsg.Recipients;
		Outlook.Recipient oRecip = (Outlook.Recipient)oRecips.Add("testemail1@testemail.com");
		oRecip.Resolve();
		// Save.
		oMsg.Save();
		// Clean up.
		oRecip = null;
		oRecips = null;
		oMsg = null;
		oApp = null;
	}
	catch
	{
	}
	return null;
}             

         

Let me know if I missed a step...

What is taking place is GetStudentInfo connects to our server, and returns data.  ProcessHousingInfo takes the student name returned and prints a few invoices etc.  I then want the student name to be input into an email draft using the code.  But I can't seem to get that step down :(





Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>