Created
November 8, 2012 00:51
-
-
Save tatsuyaueda/4035696 to your computer and use it in GitHub Desktop.
VB.net Amazon SES Sendmail Sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dim sesClient As AmazonSimpleEmailServiceClient = New AmazonSimpleEmailServiceClient(strAccessID, strSecretAccessKey) | |
Dim sesBody As Model.Body = New Model.Body(New Model.Content(txtBody.Text)) | |
Dim sesMsg As Model.Message = New Model.Message(New Model.Content(txtSubject.Text), sesBody) | |
Dim sesDest As Model.Destination = New Model.Destination() | |
sesDest.ToAddresses.Add(strToAddress) | |
Dim sesReq As Model.SendEmailRequest = New Model.SendEmailRequest(strFromAddress, sesDest, sesMsg) | |
sesClient.SendEmail(sesReq) |
CODE.
Private Sub cmdEnviarMail_Click(sender As Object, e As EventArgs) Handles cmdEnviarMail.Click
Try
Dim sesClient As AmazonSimpleEmailServiceClient = New AmazonSimpleEmailServiceClient(awsAccessKey, awsSecretKey, Amazon.RegionEndpoint.USEast2)
Dim sesBody As Model.Body = New Model.Body(New Model.Content(txtBody.Text))
Dim sesMsg As Model.Message = New Model.Message(New Model.Content(txtSubject.Text), sesBody)
Dim sesDest As Model.Destination = New Model.Destination()
sesDest.ToAddresses.Add(recipient)
Dim sesReq As Model.SendEmailRequest = New Model.SendEmailRequest(source, sesDest, sesMsg)
sesClient.SendEmail(sesReq)
MsgBox("Email enviado con EXITO !!! ", MsgBoxStyle.Exclamation, "ITG Informa")
Catch ex As Exception
MsgBox("ERROR al enviar el email", MsgBoxStyle.Critical, "ITG Informa")
MessageBox.Show(ex.Message)
End Try
End Sub
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi, I am getting error with this code
error THE SECURITY TOKEN INCLUDE IN THIS REQUEST IS INVALID
please please
CAN U HELLP ME?