以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助] 有关邮件问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=186578) |
|
-- 作者:sanny -- 发布时间:2023/5/12 20:59:00 -- [求助] 有关邮件问题 老师, 以下可以改用outlook邮箱发送吗 ? [此贴子已经被作者于2023/8/13 19:09:31编辑过]
|
|
-- 作者:有点蓝 -- 发布时间:2023/5/13 8:48:00 -- http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=107403&skin=0 |
|
-- 作者:sanny -- 发布时间:2023/5/13 11:15:00 -- 老师,可以用以下代码发outlook邮件,但是黄色标注的如何加入到以下代码中用outlook邮件发出 ?
|
|
-- 作者:有点蓝 -- 发布时间:2023/5/13 11:24:00 -- Dim o As New Microsoft.Office.Interop.Outlook.Application For Each dr As DataRow In DataTables("借款").Select("到期日期<= #" & Date.Today.AddDays(10) & "#")Dim msg As Microsoft.Office.Interop.Outlook.MailItem msg = o.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem)
msg.Recipients.Add(dr("邮件地址")) \'收件人郵件地址 msg.Subject = "催款通知" msg.Body = dr("姓名") & dr("尊称") & ":" & ln & "您的贷款将于" & dr("到期日期") & "到期, " msg.Send() Next |
|
-- 作者:sanny -- 发布时间:2023/5/13 11:56:00 -- 老师,再请教一下,如何把到期日期的所有记录都带出来,目前只有出来一笔记录。 Dim o As New Microsoft.Office.Interop.Outlook.Application Dim msg As Microsoft.Office.Interop.Outlook.MailItem Dim m As New MailSender Dim ln As String = vbcrlf & vbcrlf For Each dr As DataRow In DataTables("表a").Select("到期日期<= #" & Date.Today.AddDays(10) & "#") msg = o.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem) msg.Subject = "催款通知" msg.Body = dr("姓名") & dr("尊称") & ":" & ln & "您的贷款将于" & dr("到期日期") & "到期, " Next msg.Recipients.Add("收件人") msg.Send() msgbox("Done") |
|
-- 作者:有点蓝 -- 发布时间:2023/5/13 13:19:00 -- 如果数据没有加载使用sqlselect |
|
-- 作者:sanny -- 发布时间:2023/5/13 16:00:00 -- 老师,同时又增加了个附件 msg.Attachments.Add("d:\\Book.xlsx") 并把这表Book1中的内容如下 如何提取增加到邮件正文中,如下: |
|
-- 作者:sanny -- 发布时间:2023/5/15 12:06:00 -- 老师,这样可以达成吗? |
|
-- 作者:有点蓝 -- 发布时间:2023/5/15 13:29:00 -- 比较麻烦。可以试试提取execl里的数据合并为html的table表格 |
|
-- 作者:sanny -- 发布时间:2023/5/15 20:02:00 -- 老师,如下是在Excel中点按钮后转到邮件正文中的,如何用foxtable窗口按钮操作,还请指导一下,谢谢。 Dim olmail As outlook.MailItem Dim r As Integer, c As Integer, u As Integer Dim TableRow As Integer, Tablecolumn As Integer Dim OLT As String Set OLAPP = New outlook.Application Set olmail = OLAPP.createItem(olmailItem) OLT = "<tabel class = MsotableGrid border = 1 cellspacing =0 cellpadding =0 style =\'border-collapse:border:none:mso-border-alt:solid windowstext.5pt:mso-yfti-tbl ollk:1184:mso-padding-alt:0IN 5.4PT Oin 5.4pt\'>" For TableRow = 2 To 22 OLT = OLT & "<tr style = \' mso-yfti-irow:0:mso-yfti-firstrow:yes:height:.2in\'>" For Tablecolumn = 1 To 14 OLT = OLT & " <td width=65 nowrap valign=top style=\'width:125pt;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt;height:.2in\'><p class=MsoNormal>" & "<font face=""Calibri"" size=""3"" color=""black"">" & Cells(TableRow, Tablecolumn) & " <o:p></o:p></p></td>" Next OLT = OLT & " </tr>" Next OLT = OLT & "</table>" With olmail .TO = "11@XX.COM" .CC = "" .BCC " """ .Subject = "XX" .hTMLBODY = "hI , <br><br> " & OLT & "<br><br> yy " End With Set OLAPP = Nothing End Sub |