问题描述
我在 Visual Basic asp.net 上创建了一个控制台程序,它通过 post API 调用发送生成的电子邮件。我成功地通过sendgrid使用godaddy域向任何收件人电子邮件发送电子邮件。在这个域godaddy上,我设置了一个proofpoint加密附件,它应该通过在主题行中放置“[encrypt]”的触发器来创建加密的电子邮件。但是,它没有触发,因为要自动将加密附加到电子邮件,它必须通过 Office 365 服务器。由于我根据工作流程使用 sendgrid,因此它不会通过 Outlook 进行任何操作:
https://sendgrid.com/docs/ui/sending-email/email-flow/
我一直在做研究,我看到 send sendgrid 支持使用 TLS 的端到端加密。但是,我在任何地方都找不到如何使用 sendgrid 和 Visual Basic API 调用来建立这种加密。该计划适用于将通过电子邮件发送患者信息的医疗诊断公司,以保持 HIPPA 合规性,必须以某种方式对电子邮件进行加密。代码如下:
Private Sub SendEmail(ParaMETERS_FOR_AUTOMATING_EMAIL)
Try
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12
Dim uri As String = "https://api.sendgrid.com/v3/mail/send"
Dim Request As WebRequest = WebRequest.CreateHttp(uri)
Request.Method = "POST"
Request.PreAuthenticate = True
Request.Headers.Add("Authorization","Bearer API_KEY")
Dim json_data As String = "{""personalizations"": [{""To"": [{""email"": ""TO_EMAIL""}]}],""from"": {""email"": ""FROM_EMAIL""},""subject"":""[Encrypt]This is a automated report"",""content"": [{""type"": ""text/html"",""value"": ""Hello!,<br>Please find attachment.""}],""attachments"": [{""content"": ""File_translated_to_64_encoded"",""type"": ""EXCEL_MIME"",""filename"": ""FILE_NAME_FOR_ATTACHMENT""}]}}"
Request.ContentType = "application/json"
Dim json_bytes() As Byte = Encoding.UTF8.GetBytes(json_data)
Request.ContentLength = json_bytes.Length
Using requeststream = Request.GetRequestStream
requeststream.Write(json_bytes,json_bytes.Length)
End Using
Dim responsecontent As String = nothing
Using Response = DirectCast(Request.GetResponse,HttpWebResponse),responseStream = Response.GetResponseStream()
Using reader = New StreamReader(responseStream)
responsecontent = reader.ReadToEnd()
End Using
End Using
Catch ex As Exception
ErrLog(ex,currentLociD)
End Try
End Sub
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)