AWS查明使用.NET Core的附件(PDF)发送电子邮件
我在控制台应用程序中使用 AWS Pinpoint。我可以通过它发送 SimpleEmail。 像这样的事情:
var sendRequest = new SendMessagesRequest
{
ApplicationId = appId,
MessageRequest = new MessageRequest
{
Addresses = new Dictionary<string, AddressConfiguration>
{
{
demomail,
new AddressConfiguration
{
ChannelType=ChannelType.EMAIL
}
}
},
MessageConfiguration = new DirectMessageConfiguration
{
EmailMessage = new EmailMessage
{
SimpleEmail = new SimpleEmail
{
HtmlPart = new SimpleEmailPart
{
Charset = "UTF-8",
Data = @"<html><head></head><body><h1>Amazon Pinpoint Email Test (AWS SDK for .NET)</h1></body></html>"
},
TextPart = new SimpleEmailPart
{
Charset = "UTF-8",
Data = @"This email was sent using the Amazon Pinpoint API using the AWS SDK for .NET."
},
Subject = new SimpleEmailPart
{
Charset = "UTF-8",
Data = @"Test Mail"
}
}
}
}
}
};
但我想在我的电子邮件中包含附件,为此我需要使用 RawEmail。 但我找不到正确的文档来发送附有 pdf 的电子邮件。 谁能指出我或帮助我。
I am using AWS Pinpoint in my console application. I am able to send SimpleEmail through it.
Something like this:
var sendRequest = new SendMessagesRequest
{
ApplicationId = appId,
MessageRequest = new MessageRequest
{
Addresses = new Dictionary<string, AddressConfiguration>
{
{
demomail,
new AddressConfiguration
{
ChannelType=ChannelType.EMAIL
}
}
},
MessageConfiguration = new DirectMessageConfiguration
{
EmailMessage = new EmailMessage
{
SimpleEmail = new SimpleEmail
{
HtmlPart = new SimpleEmailPart
{
Charset = "UTF-8",
Data = @"<html><head></head><body><h1>Amazon Pinpoint Email Test (AWS SDK for .NET)</h1></body></html>"
},
TextPart = new SimpleEmailPart
{
Charset = "UTF-8",
Data = @"This email was sent using the Amazon Pinpoint API using the AWS SDK for .NET."
},
Subject = new SimpleEmailPart
{
Charset = "UTF-8",
Data = @"Test Mail"
}
}
}
}
}
};
But I want to include attachments in my email , for which I need to use RawEmail.
But I can't find proper documentation for sending the email with pdf attached.
Can anyone point me to it or help me out.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
精确不支持附件。对于类似的用例,我们复制了附件为AWS S3,并在电子邮件中共享链接以下载附件。
Pinpoint does not support attachments. For similar use case we have copied the attachement is AWS S3 and shared the link in the email to download the attachments.
您还可以使用 Amazon Pinpoint 活动中的自定义通道调用 Lambda 函数,该函数又可以使用原始电子邮件函数发送电子邮件中的 pdf 附件。这是示例代码:
You can also use the Custom Channel in Amazon Pinpoint Campaign to invoke a Lambda function, which can in turn use the raw-email function to send the pdf attachments in your email. Here is a sample code: