Yooo
Avec l’API Managée EWS , eaaaaaaasy 🙂
A télécharger ici : https://www.microsoft.com/en-us/download/details.aspx?id=42951
Ensuite voici un exemple en supposant que l’adresse mail sur laquelle je souhaite me connecter est
to**@li**.fr
et le mdp : testtoto
Dans l’exemple ci-dessous vous envoyer un mail de
to**@li**.fr
vers
Ad*********************@li**.com
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Exchange.WebServices.Data; namespace ConsoleApplication3 { class Program { static void Main(string[] args) { ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1); service.Credentials = new WebCredentials(" to**@li**.fr ", "testtoto"); service.TraceEnabled = true; service.TraceFlags = TraceFlags.All; service.AutodiscoverUrl(" to**@li**.fr ", RedirectionUrlValidationCallback); EmailMessage email = new EmailMessage(service); email.ToRecipients.Add(" Ad*********************@li**.com "); email.Subject = "Hello Bibliogeek :-)"; email.Body = new MessageBody("Test Envoie de mail réussi youhOuuuuuuuuuuuuuuuuuu"); email.Send(); } private static bool RedirectionUrlValidationCallback(string redirectionUrl) { // The default for the validation callback is to reject the URL. bool result = false; Uri redirectionUri = new Uri(redirectionUrl); // Validate the contents of the redirection URL. In this simple validation // callback, the redirection URL is considered valid if it is using HTTPS // to encrypt the authentication credentials. if (redirectionUri.Scheme == "https") { result = true; } return result; } } }