コード例 #1
0
        public static void SendIt(EMail email)
        {
            var msg = new AE.Net.Mail.MailMessage
            {
                Subject = email.Subject,
                Body    = email.Body,
                From    = new MailAddress(UserName)
            };

            msg.To.Add(new MailAddress(email.ToEmailAddress));
            msg.ReplyTo.Add(msg.From); // Bounces without this!!
            var msgStr = new StringWriter();

            msg.Save(msgStr);
            // Context is a separate bit of code that provides OAuth context;
            // your construction of GmailService will be different from mine.
            if (_service == null)
            {
                _service = new GMailService();
            }
            _service.Service.Users.Messages.Send(new Message
            {
                Raw = Base64UrlEncode(msgStr.ToString())
            }, UserName).Execute();
        }
コード例 #2
0
 private static void SetupGMailService()
 {
     _service = new GMailService();
 }