2
私は現在、ファイルを自動化して電子メール送信して送信する既存のコードを持っています。私は今CCを追加する必要があります。私はすべてを見てきましたが、私の既存のコードでは見つからないようです。どんな助けでも大歓迎です。ありがとうございました。電子メールにCCを追加する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:には見通しではなくCCのように私はどうにかしてどこかの行にCCの文字列を付ける必要がありますか? –
私が知っている限り、CC受信者の名前をCCプロパティに設定すると、受信者コレクション内の受信者に一致するものに十分になります。 –
私はこの回答が受け入れられたことを知っています。私は、受信者コレクションを通じて受信者を操作することをマイクロソフトが推奨すると付け加えたいと思います。 To、CCおよびBCCプロパティは、受信者を読み取るためにのみ使用する必要があります。 CC受信者を設定するには、新しい受信者を追加するJamieのコードの直後に、TypeプロパティをolCC(またはBCC受信者の場合はolBCC)に設定します。 – JimmyPena