using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Net.Mail;
using Microsoft.Exchange.WebServices.Data;
namespace Email
{
class Program
{
static void Main(string[] args)
{
try
{
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
service.UseDefaultCredentials = false;
service.Credentials = new NetworkCredential("id_in_server", "Password_in_server");
service.Url = new Uri("https://myexchangeserver/EWS/exchange.asmx");
Console.WriteLine(service.Url);
service.TraceEnabled = true;
EmailMessage message = new EmailMessage(service);
message.Subject = "Hello from the EWS Managed API";
message.Body = "Good Job!";
message.ToRecipients.Add("recipient_mail_address");
//message.Save();
message.SendAndSaveCopy();
}catch(Exception e)
{
Console.WriteLine(e.ToString());
}
}
}
}
我发送邮件使用EWS,C#没有outlook,它工作正常。但是在C ++中,我不能,如果使用MAPI库1配置文件outlook需要。我在C ++ http://social.msdn.microsoft.com/Forums/en-US/wwsapi/thread/adf2a58c-32b7-477a-adcc-f2d053e2902b中看到一个使用Webservice的例子,但我不能用它。现在,我想通过Exchange服务器使用C ++发送邮件而不使用Outlook。请帮我。感谢
答案 0 :(得分:1)
我解决了这个问题。 这是答案http://social.msdn.microsoft.com/Forums/en-US/wwsapi/thread/f0800af0-e62f-4b62-96e6-c504923ab77a 我使用WWSAPI connect与C ++交换服务器。