2012-09-28 3 views
0

나는 visual studio 2008의 Windows phone 용 응용 프로그램을 보내는 간단한 전자 메일을 만들려고하는데 어떤 클래스 나 메서드를 사용해야하는지 알려주십시오. Windows Mobile 5.0에서 이메일을 보내는 방법

내가이 시도했지만 작동하지 않았다 :

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?) 
+0

를 엽니 다 필요한 물건이없는 베어 조각입니다'- 그것은 아무튼 어쨌든 당신이 안전하다고 느끼는 것을 제외하고는 아무 것도하지 마십시오. – jp2code

답변

1

닷넷 컴팩트 프레임 워크를 지원하지 않습니다 System.Net.Mail 또는 시스템 . 웹. 우편. http://www.opennetcf.com/library/sdf/html/7e16eccb-dc9e-4559-c79c-cfaad631ac15.htm과 같은 내선 번호를 사용하거나 사용자를 대신하여 전자 메일을 보낼 서비스를 호출 할 수 있습니다.

+0

내 코드는 Windows 양식 응용 프로그램에서 작동하지만 Windows 전화 응용 프로그램에서는 작동하지 않습니다. Windows Phone 응용 프로그램은 System.Net.Mail 또는 System.Web.Mail이 아닙니다. – Jericho

+0

Windows Phone 또는 Windows Mobile을 사용하고 있습니까? 그것들은 매우 다른 두 가지 플랫폼입니다. Windows Mobile은 Winforms 응용 프로그램에 사용할 .NET Framework에서 이식 된 기능의 하위 집합 인 .NET Compact Framework를 사용합니다. – LewisBenge

+0

좋아, 나는 그것에 대해 몰랐다, 나는 창문 모바일에 대해 묻고있다. – Jericho

0

Windows Mobile에서 메일 등을 보내려면 VisualStudio C#/VB SmartDevice 프로젝트를 시작해야합니다.

메일 등은 네임 스페이스 microsoft.windowsmobile.pocketoutlook을 통해 액세스 할 수 있습니다. WindowsMobile 어셈블리가 포함 된 Windows Mobile 5 (이상) SDK 디렉토리에 대한 참조를 추가해야합니다. 여기

http://msdn.microsoft.com/en-us/library/microsoft.windowsmobile.pocketoutlook.aspx

먼저 Application.DoEvents()`꺼낼 수 POOM 계정 등 :

http://cjcraft.com/blog/2008/10/02/how-to-open-a-mail-in-inbox-using-pocket-outlook/

관련 문제