When you declare a method, like your SendEmail method, you provide parameters which consist of the type of the data, and the name of a variable to store the data in.
It's just like you had this inline code:
string myName = "OriginalGriff";
string yourName = "Member 8010354";
...
string userName = myName;
username = "The user's name is: " + userName;
Console.WriteLine(userName);
...
username = yourname;
username = "The user's name is: " + userName;
Console.Writeline(username);
...
You could take the "common code" and make that a method:
public void ShowUsername(string userName)
{
username = "The user's name is: " + userName;
Console.Writeline(username);
}
...
string myName = "OriginalGriff";
string yourName = "Member 8010354";
ShowUsername(myName);
ShowUsername(yourName);
The name of the parameter variable is only relevant inside the method, it can't be accessed outside.
In your case, all you have to do is call SendEmail and pass it the relevant parameter data:
SendEmail("Original", "Griff", originalGriffEmailAddress, "Hello!", "I have no idea what a task id is");
As long as the variable
originalGriffEmailAddress
exists and holds my email address as a string, it'll work.
More specific than that I can't be: you don't show where you call the method, or where that foreach loop code you show fits into your program.