using UnityEngine; using UnityEngine.UI; using System.Collections; using System.Text.RegularExpressions; using Amazon.SimpleEmail; using Amazon.Runtime; using Amazon.CognitoIdentity; using Amazon; using Amazon.SimpleEmail.Model; using System.Collections.Generic; namespace AWSSDK.Examples { public class SESExample : MonoBehaviour { public string IdentityPoolId = ""; public string CognitoIdentityRegion = RegionEndpoint.USEast1.SystemName; private RegionEndpoint _CognitoIdentityRegion { get { return RegionEndpoint.GetBySystemName(CognitoIdentityRegion); } } public string SESRegion = RegionEndpoint.USEast1.SystemName; private RegionEndpoint _SESRegion { get { return RegionEndpoint.GetBySystemName(SESRegion); } } public InputField txtToEmailAddress; public InputField txtEmailContent; public InputField txtEmailSubject; public InputField txtFromEmailAddress; public Button btnSend; private const string EmailAddressValidator = @"^(?("")("".+?(?() { toEmailAddress } }, Message = new Message() { Subject = new Content(subject), Body = new Body(new Content(emailBody)) }, ReplyToAddresses = new List { fromEmailAddress }, Source = fromEmailAddress }, (responseObj) => { if (responseObj.Exception == null) { var response = responseObj.Response; Debug.Log(@"Message sent"); Debug.Log(string.Format(@"Http Status Code = {0}", response.HttpStatusCode)); } else { Debug.LogException(responseObj.Exception); } }); } private bool ValidateEmail(string email) { return Regex.IsMatch(email, EmailAddressValidator, RegexOptions.IgnoreCase); } } }