使用 VBA 和 CDO 邮件对象通过 SMS 向 iPhone 发送向上箭头“↑”字符
Posted
技术标签:
【中文标题】使用 VBA 和 CDO 邮件对象通过 SMS 向 iPhone 发送向上箭头“↑”字符【英文标题】:Send up arrow `↑` character to iPhone with SMS using VBA and a CDO mail object 【发布时间】:2017-05-12 00:12:29 【问题描述】:我需要使用 VBA 和 CDO 邮件对象通过 SMS 向 iPhone 发送向上箭头 ↑
。
我的尝试如下:
Unicode:
subj = ChrW(8593) & " Up " & ChrW(8593)
HTML:
subj = "↑ Up ↑"
上述两种方法都会导致 iPhone 接收到 Unicode 的 ? Up ?
或作为字符串文字的 ↑ Up ↑
。
有人知道向上箭头↑
的正确语法吗?
【问题讨论】:
您想通过短信发送Oliver Queen? 那不需要StrConv
电话吗?
大声笑;我想他的颤抖可能会被 SMTP 端口卡住,所以我会接受 ↑字符。
@Mat'sMug - 如果 iPhone 正在将 html 转换为富文本,那么我认为 HTML 可以工作,但不能。此外,Unicode 在服务器上或通过接收 SMS 被剥离,而不是在我发送它时。我知道您可以使用表情符号等发送 iPhone 消息,但我不知道它们是如何编码的。 edit 我会尝试以 strconv(.., vbunicode) 发送。
抱歉@Mat'sMug,strconv(.., vbunicode)
将主题弄得乱七八糟,并完全截断消息正文(可能是因为遇到了 0x0 字符)。
【参考方案1】:
解决方案:
我一直在寻找一些“特殊字符”语法,但问题不在于消息的构造。我需要将 .BodyPart.Charset = "utf-8"
添加到 CDO.Message 对象并在需要的地方使用 Unicode Chrw(8593)
。
Sub sendMSSG(sbj As String, mssg As String)
Dim cdoMail As New CDO.Message
On Error GoTo err_Report
With cdoMail
With .Configuration.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort '2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "my.smtpserverserver.net"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic '1
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = sFROM
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = sFROMPWD
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 6
.Update
End With
.BodyPart.Charset = "utf-8" '<~~ THIS WAS REQUIRED
.Subject = sbj
.From = sFROM
.To = sPHONEMSSGNO
.Bcc = vbNullString
.Cc = vbNullString
.TextBody = mssg
.Send
End With
Exit Sub
err_Report:
Debug.Print Err.Number & ": " & Err.Description
End Sub
显然,.BodyPart.Charset
涵盖了主题和消息正文,因为我能够在两者中使用 unicode。
任何计划将此代码用于自己目的的人都需要通过工具、参考将 Microsoft CDO for Windows 2000 库添加到他们的项目中。
【讨论】:
以上是关于使用 VBA 和 CDO 邮件对象通过 SMS 向 iPhone 发送向上箭头“↑”字符的主要内容,如果未能解决你的问题,请参考以下文章
CDO 在端口 465 和 587 上连接失败,但在 25 上工作