2
현재 자동화하고 전자 메일을 보내고 파일을 보내는 기존 코드가 있습니다. 이제는 참조를 추가해야합니다. 나는 모든 것을 살펴 보았지만 기존의 코드로는 찾을 수없는 것 같습니다. 어떤 도움이라도 대단히 감사하겠습니다. 고맙습니다.전자 메일에 참조를 추가하는 Microsoft Outlook
private void button13_Click(object sender, EventArgs e)
{
//Send Routing and Drawing to Dan
// Create the Outlook application by using inline initialization.
Outlook.Application oApp = new Outlook.Application();
//Create the new message by using the simplest approach.
Outlook.MailItem oMsg = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
//Add a recipient
Outlook.Recipient oRecip = (Outlook.Recipient)oMsg.Recipients.Add("[email protected]");
oRecip.Resolve();
//Set the basic properties.
oMsg.Subject = "Job # " + textBox9.Text + " Release (" + textBox1.Text + ")";
oMsg.HTMLBody = "<html><body>";
oMsg.HTMLBody += "Job # " + textBox9.Text + " is ready for release attached is the Print and Routing (" + textBox1.Text + ")";
oMsg.HTMLBody += "<p><a href='C:\\Users\\RussellS\\Desktop\\Russell Eng Reference\\" + textBox1.Text + ".PDF'>" + textBox1.Text + " Drawing";
oMsg.HTMLBody += "<p><a href='C:\\Users\\RussellS\\Desktop\\" + textBox1.Text + ".PDF'>" + textBox1.Text + " Routing" + "</a></p></body></html>";
//Send the message
oMsg.Send();
//Explicitly release objects.
oRecip = null;
oMsg = null;
oApp = null;
MessageBox.Show(textBox1.Text + " Print and Routing Sent");
}
하지만, 그것이 추가 TO : to outlook과 cc가 아니므로 어떻게 든 어딘가에 줄의 CC 문자열을 사용해야합니까? –
필자가 아는 한 CC 수신자의 이름으로 CC 속성을 설정하면 수신자 모음의 수신자와 일치하는 것으로 충분합니다. –
이 대답이 받아 들여 졌음을 알고 있으며, Microsoft는받는 사람 컬렉션을 통해받는 사람을 조작 할 것을 권장한다고 덧붙였습니다. 받는 사람, 참조 및 숨은 참조 정보는받는 사람을 읽는 데에만 사용해야합니다. 참조 수신자를 설정하려면 Type 속성을 olCC (또는 숨은 참조 수신자의 경우 olBCC)로 설정합니다. 위의 Jamie의 코드 바로 다음에 새 수신자가 추가됩니다. – JimmyPena