2017-03-11 44 views
1

SendRawEmail操作を使用してAWS golang sdkで電子メールを送信する際に問題が発生しました。エラーはなく、AWSからMessageIdを返信しても、メールは届きません。AWS SESがSendRawEmail操作を使用して電子メールを送信しない

SendEmailを使用してメールを送信するとうまく動作し、メールが届きます。

マイコード:

session, err := session.NewSession() 
    if err != nil { 
    return err 
    } 

    svc := ses.New(session, &aws.Config{Region: aws.String("eu-west-1")}) 

    messageContent := `From: "Alice" <[email protected]> 
To: "Bob" <[email protected]> 
Return-Path: <[email protected]> 
Subject: Hello 
Content-Language: en-US 
Content-Type: text/plain; charset="us-ascii" 
MIME-Version: 1.0 

This is a test email` 

    base64messageContent := base64.StdEncoding.EncodeToString([]byte(messageContent)) 

    source := aws.String("[email protected]") 
    destinations := []*string{aws.String("[email protected]")} 
    message := ses.RawMessage{Data: []byte(base64messageContent)} 

    input := ses.SendRawEmailInput{Source: source, Destinations: destinations, RawMessage: &message} 

    output, err := svc.SendRawEmail(&input) 

    if err != nil { 
    return err 
    } 

    log.Println("Response from SES", output) 

    return nil 
} 

それはすべての違いを、私は、先の電子メールとしての私のGmailを使用しています。

+2

応答からMessageIdを受け取ると、 'SendRawEmail'への呼び出しが成功したことを意味します。ただし、必ずしも配信が成功したとは限りません。この問題をさらに解決するために、[Amazon SNS通知(SES)の設定](http://docs.aws.amazon.com/ses/latest/DeveloperGuide/configure-home.asp)を使用して、配信ステータス(バウンス)を調べることをお勧めします。 sns-notifications.html#configure-feedback-notifications-console)、SNSトピックにメールを登録して、配信ステータスや障害の理由を確認してください。 –

答えて

2

DataRawDataは、base64でエンコードしないでください。 As documentation states

//データはSDKによって自動的にベース64エンコード/デコードされます。

関連する問題