来自Access的HTML电子邮件 [英] HTML Emails from Access

查看:91
本文介绍了来自Access的HTML电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

道歉,如果之前已经介绍过 - 我找不到它。


我目前使用ASPEmail创建和发送来自Access的HTML电子邮件

数据库。文本是个性化的,包括嵌入式图形,例如

徽标甚至收件人照片。请注意,所有内容都是嵌入的,

没有发送附件。 ASPEmail是一种享受,但是很长时间用于创建。电子邮件设计作为完成的HTML来找我,但我必须提取源并将其转换为字符串 - 不是那么简单的一个

过程 - 并且写得相当多围绕它的代码实际上得到了

的工作。


做一些比我已经做过的更好的事情

文件,即设置带书签的模板并使用自动化

来调出文档,放入数据字段并打印出来。有没有

这样我可以用于Outlook?


或者有人知道是否有更好的方法来做到这一点?我很高兴

支付第三方解决方案。


谢谢

Dave

Apologies if this has been covered before - I couldn''t find it.

I currently use ASPEmail to create and send HTML emails from an Access
database. The text is personalised and includes embedded graphics, eg
logos and even the recipients photo. Note that everything is embedded,
no attachments are sent. ASPEmail works a treat but is very long winded
to create. The email designs come to me as finished HTML but I have to
extract the source and convert it to a string - not that simple a
process - and write quite a bit of code around it to actually get the
thing to work.

What would be nicer would be to do something like I already do for word
documents, that is, set up a template with bookmarks and use automation
to bring up the document, put in the data fields and print it. Is there
something like this I could use with Outlook?

Or does anyone know if there is a better way to do this? I''m happy to
pay for a 3rd party solution.

Thanks
Dave

推荐答案

Dave G @ K2写道:
Dave G @ K2 wrote:
道歉如果之前已经覆盖过 - 我找不到它。

我目前使用ASPEmail从Access
数据库创建和发送HTML电子邮件。文本是个性化的,包括嵌入式图形,例如
徽标甚至收件人照片。请注意,所有内容都已嵌入,
不会发送任何附件。 ASPEmail是一种享受,但是很长时间的创造。电子邮件设计作为完成的HTML来找我,但我必须提取源并将其转换为字符串 - 而不是简单的过程 - 并编写相当多的代码来实际获取
要工作的东西。

做一些像我已经做过的单词
文件更好,也就是说,用书签设置模板并使用自动化
调出文档,放入数据字段并打印出来。是否有这样的东西我可以使用Outlook?

或者有人知道是否有更好的方法来做到这一点?我很高兴为第三方解决方案买单。

谢谢
戴夫
Apologies if this has been covered before - I couldn''t find it.

I currently use ASPEmail to create and send HTML emails from an Access
database. The text is personalised and includes embedded graphics, eg
logos and even the recipients photo. Note that everything is embedded,
no attachments are sent. ASPEmail works a treat but is very long winded
to create. The email designs come to me as finished HTML but I have to
extract the source and convert it to a string - not that simple a
process - and write quite a bit of code around it to actually get the
thing to work.

What would be nicer would be to do something like I already do for word
documents, that is, set up a template with bookmarks and use automation
to bring up the document, put in the data fields and print it. Is there
something like this I could use with Outlook?

Or does anyone know if there is a better way to do this? I''m happy to
pay for a 3rd party solution.

Thanks
Dave




考虑代码下面。如果它被广泛使用,那么使用html文件

路径之类的参数重写它将是明智的。可能应该包含一个错误处理程序,这使得低级DOS文件被关闭,即使其他一些问题终止,也就是代码的执行。 (在过去,未封闭的低级DOS

文件可能会困扰一个人的计算机很长一段时间,导致所有的b / b
类型的破坏。我不喜欢不知道这是不是真的。)我希望你

已经知道在HTML电子邮件中可能需要使用绝对hrefs,

srcs等img Alts也是一个好主意。


如果HTML文件有不同的占位符,例如PlaceHolderOne,

可以做simple替换以使每个发送唯一。我在发布代码时已经完成了这个



Public Sub VerySimpleSendHTMLMailWithCDOSample()


Dim iCfg As Object

Dim iMsg As Object


Dim FileNumber As Integer

Dim Buffer As String


FileNumber = FreeFile()

打开C:\Documents and Settings \ Lyle Fairfield \ Myy />
Documents\FFDBABackup\ index.html"对于Binary As #FileNumber

Buffer = String(LOF(FileNumber),vbNullChar)

获取#FileNumber ,,缓冲区

关闭#FileNumber


设置iCfg = CreateObject(" CDO.Configuration")

设置iMsg = CreateObject(" CDO.Message")

>
使用iCfg.Fields

..Item(" http://schemas.microsoft.com/cdo/configuration/sendusing")= 2

..Item(" http://schemas.microsoft.com/cdo/configuration/smtpserverport")

= 25

..Item(" http:/ /schemas.microsoft.com/cdo/configuration/smtpserver")=

" smtp.aim.com"

..Item(" http:// schemas .microsoft.com / cdo / configuration / smtpauthenticate")

= 1

..Item(" http://schemas.microsoft.com/cdo/configuration/ sendusername")=

" eugenevdebs"

..Item(" http://schemas.microsoft.com/cdo/configuration/sendpassword")=

" Sol1dar1 ty4Ever"

..Item(" http://schemas.microsoft.com/cdo/configuration/sendemailaddress")

=" Eugene V Debs< eu ********* @ aim.com>"

..更新

结束


随着iMsg

..Configuration = iCfg

..HTMLBody = Buffer

..Subject ="这里有一些HTML"

..To =" lf ******** @ cogeco.ca"

..发送

结束


设置iMsg = Nothing

设置iCfg = Nothing


End Sub

*** *

新闻客户将在此代码中引入无关的换行符。

****

我推荐这个吗?我不!我建议将HTML文件

(个性化或非个性化)上传到服务器,并在电子邮件中发送一个指向该页面的链接

。我也有代码。



Consider the code below. If it were to be used extensively it would be
wise to rewrite it using parameters for such things as the html file
path. Probably, an error handler should be included which makes certain
the low-level DOS File is closed, even if some other problem terminates
the execution of the code. (In the olden days, unclosed low-level DOS
files could haunt one''s computer for a very long time, causing all
sorts of havoc. I don''t know if this is still true.) I expect that you
already know that in HTML E-Mail one may have to use absolute hrefs,
srcs etc in img and other tags etc. Alts are a good idea too.

If the HTML file has distinct placeholders, such a "PlaceHolderOne",
one can do simple Replaces to make each send unique. I have done this
previously when posting code.

Public Sub VerySimpleSendHTMLMailWithCDOSample()

Dim iCfg As Object
Dim iMsg As Object

Dim FileNumber As Integer
Dim Buffer As String

FileNumber = FreeFile()
Open "C:\Documents and Settings\Lyle Fairfield\My
Documents\FFDBABackup\index.html" For Binary As #FileNumber
Buffer = String(LOF(FileNumber), vbNullChar)
Get #FileNumber, , Buffer
Close #FileNumber

Set iCfg = CreateObject("CDO.Configuration")
Set iMsg = CreateObject("CDO.Message")

With iCfg.Fields
..Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
..Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")
= 25
..Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"smtp.aim.com"
..Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")
= 1
..Item("http://schemas.microsoft.com/cdo/configuration/sendusername") =
"eugenevdebs"
..Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") =
"Sol1dar1ty4Ever"
..Item("http://schemas.microsoft.com/cdo/configuration/sendemailaddress")
= "Eugene V Debs <eu*********@aim.com>"
..Update
End With

With iMsg
..Configuration = iCfg
..HTMLBody = Buffer
..Subject = "Here''s Some HTML"
..To = "lf********@cogeco.ca"
..Send
End With

Set iMsg = Nothing
Set iCfg = Nothing

End Sub
****
News clients will introduce extraneous line-feeds in this code.
****
Do I recommend this? I do not! I recommend uploading the HTML file
(personalized or not) to a server and sending a link to that page in
the e-mail. I have code for that too.


谢谢Lyle


但我的一个问题是主题。使用您建议的

代码或我正在使用的系统,我需要将原始HTML

转换为文本字符串,这就是因为我的

客户喜欢设计一些非常长的电子邮件来加载表格,字体

更改等等,所以需要花费时间。我全都怀疑,放入图形和

变量等等,它运行得很漂亮。我只是想找到

a的捷径。


Dave

Lyle Fairfield写道:
Thanks Lyle

But one of my problems is the subject line. Using either your suggested
code, or the system I''m currently using, I need to convert the raw HTML
into a text string, and that''s the bit that takes the time because my
client likes designing some pretty long emails loads of tables, font
changes etc etc. I have it all sussed, putting in graphics and
variables and so on, and it works beautifully. I''m just trying to find
a short cut really.

Dave
Lyle Fairfield wrote:
Dave G @ K2写道:
Dave G @ K2 wrote:
道歉如果之前已经介绍过 - 我找不到它。

我目前使用ASPEmail创建和发送HTML来自Access
数据库的电子邮件。文本是个性化的,包括嵌入式图形,例如
徽标甚至收件人照片。请注意,所有内容都已嵌入,
不会发送任何附件。 ASPEmail是一种享受,但是很长时间的创造。电子邮件设计作为完成的HTML来找我,但我必须提取源并将其转换为字符串 - 而不是简单的过程 - 并编写相当多的代码来实际获取
要工作的东西。

做一些像我已经做过的单词
文件更好,也就是说,用书签设置模板并使用自动化
调出文档,放入数据字段并打印出来。是否有这样的东西我可以使用Outlook?

或者有人知道是否有更好的方法来做到这一点?我很高兴为第三方解决方案买单。

谢谢
戴夫
Apologies if this has been covered before - I couldn''t find it.

I currently use ASPEmail to create and send HTML emails from an Access
database. The text is personalised and includes embedded graphics, eg
logos and even the recipients photo. Note that everything is embedded,
no attachments are sent. ASPEmail works a treat but is very long winded
to create. The email designs come to me as finished HTML but I have to
extract the source and convert it to a string - not that simple a
process - and write quite a bit of code around it to actually get the
thing to work.

What would be nicer would be to do something like I already do for word
documents, that is, set up a template with bookmarks and use automation
to bring up the document, put in the data fields and print it. Is there
something like this I could use with Outlook?

Or does anyone know if there is a better way to do this? I''m happy to
pay for a 3rd party solution.

Thanks
Dave



请考虑以下代码。如果它被广泛使用,那么使用html文件
路径等参数重写它是明智的。可能应该包含一个错误处理程序,这使得低级DOS文件被关闭,即使其他一些问题终止了代码的执行。 (在过去,未封闭的低级别DOS文件可能会困扰一个人的计算机很长一段时间,导致所有类型的破坏。我不知道这是否仍然是真的。)我希望你已经知道在HTML电子邮件中,人们可能不得不在img和其他标签等中使用绝对的hrefs,
srcs等。这也是一个好主意。

如果HTML文件具有不同的占位符,例如PlaceHolderOne,则可以执行简单的替换以使每个发送都是唯一的。我之前在发布代码时已经完成了这个。

Public Sub VerySimpleSendHTMLMailWithCDOSample()

将iCfg视为对象
将iMsg视为对象

Dim FileNumber作为整数
Dim Buffer As String

FileNumber = FreeFile()
打开C:\Documents and Settings \Lyle Fairfield \ Myy
Documents\FFDBABackup\index.html"对于二进制为#FileNumber
缓冲区=字符串(LOF(FileNumber),vbNullChar)
获取#FileNumber ,,缓冲区
关闭#FileNumber

设置iCfg = CreateObject( CDO.Configuration)
设置iMsg = CreateObject(CDO.Message)

使用iCfg.Fields
.Item(" http:// schemas。 microsoft.com/cdo/configuration/sendusing")= 2
.Item(" http://schemas.microsoft.com/cdo/configuration/smtpserverport")
= 25
。项目(http://schemas.microsoft.com/cdo/configuration/smtpserver")=
smtp.aim.com"
.Item(" http://schemas.microsoft .com / cdo / configuration / smtpauthenticate")
= 1
.Item(" http://schemas.microsoft.com/cdo/configuration/sendusername")=
" eugenevdebs" ;
.Item(" http://schemas.microsoft.com/cdo/configuration/sendpassword")=
" Sol1dar1ty4Ever"
.Item(" http:// schemas .microsoft.com / CDO /配置/ sendemailaddre ss")
=" Eugene V Debs< eu ********* @ aim.com>"
。更新
结束
.Configuration = iCfg
.HTMLBody = Buffer
.Subject ="这里有一些HTML"
.To =" lf **** **** @ cococo.ca"
。发送
结束

设置iMsg = Nothing
设置iCfg = Nothing

结束Sub
****
新闻客户将在此代码中介绍无关的换行符。
****
我推荐这个吗?我不!我建议将HTML文件(个性化或非个性化)上传到服务器,并在电子邮件中发送指向该页面的链接。我也有代码。



Consider the code below. If it were to be used extensively it would be
wise to rewrite it using parameters for such things as the html file
path. Probably, an error handler should be included which makes certain
the low-level DOS File is closed, even if some other problem terminates
the execution of the code. (In the olden days, unclosed low-level DOS
files could haunt one''s computer for a very long time, causing all
sorts of havoc. I don''t know if this is still true.) I expect that you
already know that in HTML E-Mail one may have to use absolute hrefs,
srcs etc in img and other tags etc. Alts are a good idea too.

If the HTML file has distinct placeholders, such a "PlaceHolderOne",
one can do simple Replaces to make each send unique. I have done this
previously when posting code.

Public Sub VerySimpleSendHTMLMailWithCDOSample()

Dim iCfg As Object
Dim iMsg As Object

Dim FileNumber As Integer
Dim Buffer As String

FileNumber = FreeFile()
Open "C:\Documents and Settings\Lyle Fairfield\My
Documents\FFDBABackup\index.html" For Binary As #FileNumber
Buffer = String(LOF(FileNumber), vbNullChar)
Get #FileNumber, , Buffer
Close #FileNumber

Set iCfg = CreateObject("CDO.Configuration")
Set iMsg = CreateObject("CDO.Message")

With iCfg.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")
= 25
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"smtp.aim.com"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")
= 1
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") =
"eugenevdebs"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") =
"Sol1dar1ty4Ever"
.Item("http://schemas.microsoft.com/cdo/configuration/sendemailaddress")
= "Eugene V Debs <eu*********@aim.com>"
.Update
End With

With iMsg
.Configuration = iCfg
.HTMLBody = Buffer
.Subject = "Here''s Some HTML"
.To = "lf********@cogeco.ca"
.Send
End With

Set iMsg = Nothing
Set iCfg = Nothing

End Sub
****
News clients will introduce extraneous line-feeds in this code.
****
Do I recommend this? I do not! I recommend uploading the HTML file
(personalized or not) to a server and sending a link to that page in
the e-mail. I have code for that too.






Dave G @ K2写道:
Dave G @ K2 wrote:
谢谢Lyle

但我的一个问题是主题。使用您建议的代码或我正在使用的系统,我需要将原始HTML转换为文本字符串,这就是需要的内容。
时间,因为我的客户喜欢设计一些很长的电子邮件加载表格,字体更改等等。我有所有的怀疑,插入
图形和变量等等,它工作得很漂亮。我只是想确实找到一个捷径。
Thanks Lyle

But one of my problems is the subject line. Using either your
suggested code, or the system I''m currently using, I need to convert
the raw HTML into a text string, and that''s the bit that takes the
time because my client likes designing some pretty long emails loads
of tables, font changes etc etc. I have it all sussed, putting in
graphics and variables and so on, and it works beautifully. I''m just
trying to find a short cut really.




把基础模板放进去备忘录中的HTML



Put the base "template" HTML in a memo


这篇关于来自Access的HTML电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆