Visual Studio 2008 で Windows Phone 用の簡単なメール送信アプリケーションを作成しようとしています。どのクラスまたはメソッドを使用する必要があるか教えてください。
私はこれを試しましたが、うまくいきませんでした:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Configuration;
using System.Xml;
try
{
Application.DoEvents();
// setup mail message
MailMessage message = new MailMessage();
message.From = new MailAddress(textBox1.Text);
message.To.Add(new MailAddress(textBox2.Text));
message.Subject = textBox3.Text;
message.Body = textBox5.Text;
// setup mail client
SmtpClient mailClient = new SmtpClient("smtp.gmail.com");
mailClient.Credentials = new NetworkCredential(textBox1.Text, textBox4.Text);
mailClient.Send(message);
MessageBox.Show("Sent");
}
catch (Exception)
{
MessageBox.Show("Error");
}
次のエラーが表示されます。
Error 1 The type or namespace name 'MailMessage' could not be found (are you missing a using directive or an assembly reference?)
Error 2 The type or namespace name 'MailMessage' could not be found (are you missing a using directive or an assembly reference?)
Error 3 The type or namespace name 'MailAddress' could not be found (are you missing a using directive or an assembly reference?)
Error 4 The type or namespace name 'MailAddress' could not be found (are you missing a using directive or an assembly reference?)
Error 5 The type or namespace name 'SmtpClient' could not be found (are you missing a using directive or an assembly reference?)
Error 6 The type or namespace name 'SmtpClient' could not be found (are you missing a using directive or an assembly reference?)
Error 7 The type or namespace name 'SmtpClient' could not be found (are you missing a using directive or an assembly reference?)
Error 8 The type or namespace name 'SmtpClient' could not be found (are you missing a using directive or an assembly reference?)