public async Task <OperationResult> SendEmail(IEmailMessage emailMessage) { try { var msg = new MailMessage { From = new MailAddress("*****@*****.**", "Website Contact Form"), Subject = emailMessage.Subject, Body = emailMessage.Body, IsBodyHtml = emailMessage.IsBodyHtml, To = { emailMessage.To } }; var awsCredential = new AwsCredential(_awsConfig.AccessKeyId, _awsConfig.SecretKey); using (var client = new SesClient(AwsRegion.USEast1, awsCredential)) { var sendEmailResult = await client.SendEmailAsync(msg); return(OperationResult.Ok(sendEmailResult)); } } catch (Exception ex) { return(OperationResult.Error(ex)); } }
public void Parse() { var accessKey = AwsCredential.Parse("a:b"); Assert.Equal("a", accessKey.AccessKeyId); Assert.Equal("b", accessKey.SecretAccessKey); }
public StsClient(AwsCredential credential) : base(AwsService.Sts, AwsRegion.USEast1, credential) { }
public IamClient(AwsCredential credential) : base(AwsService.Iam, AwsRegion.USEast1, credential) { }
public CloudFrontClient(AwsCredential credentials) : base(AwsService.Cloudfront, AwsRegion.USEast1, credentials) { baseUrl = Endpoint + version; }
public FilesService(IDataProvider data, IOptions <AwsCredential> aws) { _data = data; _aws = aws.Value; }
private static void ConfigureLocalServices(IServiceCollection services) { services.AddSingleton <IAmazonS3>(provider => new AmazonS3Client(AwsCredential.GetCredentials())); services.AddSingleton <IAmazonDynamoDB>(provider => new AmazonDynamoDBClient(AwsCredential.GetCredentials())); }