473,320 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

emailing a PDF file created by Access...

MLH
I print to a device that creates a PDF. Knowing the filename, how can
I then embed the PDF into the body text of an OutLook Express outbound
email & send to a specified address in a table? I want recipient
addressees to see the report in the body text window of their email
when they open it. I was thinking also about attaching the PDF file to
the eMail for those having "text only" email software. I need to
automate both of these tasks from a VB procedure. IDEAS?
Nov 12 '05 #1
10 5531
MLH <CR**@NorthState.net> wrote:
I print to a device that creates a PDF. Knowing the filename, how can
I then embed the PDF into the body text of an OutLook Express outbound
email & send to a specified address in a table? I want recipient
addressees to see the report in the body text window of their email
when they open it. I was thinking also about attaching the PDF file to
the eMail for those having "text only" email software. I need to
automate both of these tasks from a VB procedure. IDEAS?


AFAIK you can't embed a file in the body of an email. You will need to create the
HTML/text as a string yourself using much VBA code.

To create a formatted document to send as an email you will need to use VBA code to
create a largish string. This string will then be passed to the SendObject command
as the body of the email. For more details including sample air code see my Tips
page on this topic at www.granite.ab.ca/access/emailformatted.htm.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 12 '05 #2
Tony, Thanks for this response. I have a similar challenge, except
that all I want to do is insert and HTML encoded message into Outlook
in such a way that the HTML is rendered properly for display when the
message is sent, just like it would be if you switched to HTML mode in
Outlook and entered the message manually complete with all formatting,
colors, fonts, etc. Right now I'm able to send text messages
(including HTML code to Outlook from an Access 2K procedure that uses
late binding to manipulate the OL object moc\del. But when I send
HTML code to Outlook, the HTML tags all appear in the body of the
message instead of being converted to readable format. I DO have
Outlook set up to default to HTML for new messages.

Any suggestions?

Thanks for your excellent contributions to this group.

--WC

On Sat, 06 Sep 2003 21:54:42 GMT, Tony Toews <tt****@telusplanet.net>
wrote:
MLH <CR**@NorthState.net> wrote:
I print to a device that creates a PDF. Knowing the filename, how can
I then embed the PDF into the body text of an OutLook Express outbound
email & send to a specified address in a table? I want recipient
addressees to see the report in the body text window of their email
when they open it. I was thinking also about attaching the PDF file to
the eMail for those having "text only" email software. I need to
automate both of these tasks from a VB procedure. IDEAS?


AFAIK you can't embed a file in the body of an email. You will need to create the
HTML/text as a string yourself using much VBA code.

To create a formatted document to send as an email you will need to use VBA code to
create a largish string. This string will then be passed to the SendObject command
as the body of the email. For more details including sample air code see my Tips
page on this topic at www.granite.ab.ca/access/emailformatted.htm.

Tony


Nov 12 '05 #3
MLH <CR**@NorthState.net> wrote in message news:<gk********************************@4ax.com>. ..
I print to a device that creates a PDF. Knowing the filename, how can
I then embed the PDF into the body text of an OutLook Express outbound
email & send to a specified address in a table? I want recipient
addressees to see the report in the body text window of their email
when they open it. I was thinking also about attaching the PDF file to
the eMail for those having "text only" email software. I need to
automate both of these tasks from a VB procedure. IDEAS?


Express does not expose any objects, so you cannot automate it
directly. You might be able to do it using the CDO libraries or
something. You should be able to find something like that at the MS
website. Look for something like "CDONTS.DLL". If I remember right,
it's just a MAPI wrapper, so it should work. Then once you have that
installed and registered, doing what you ask is trivial.

In a sub/function do the following:
Create a new mail message.
Specify the body text. Not sure how you'd paste in the PDF, though.
If you were adding normal text, it would be a snap.
Add any attachments you want. (the PDF)
specify the recipients... open a recordset of recipients inside your
function (or pass it in as an argument), then loop through them adding
them to the Recipients collection.
When everything is the way you want it, issue the .Send command of the
message object.
Nov 12 '05 #4
Pieter, Thanks for this response. I have a similar challenge, except
that all I want to do is insert and HTML encoded message into Outlook
in such a way that the HTML is rendered properly for display when the
message is sent, just like it would be if you switched to HTML mode in
Outlook (not Outlook Express) and entered the message manually
complete with all formatting, colors, fonts, etc. Right now I'm able
to send text messages (including HTML code to Outlook from an Access
2K procedure that uses late binding to manipulate the OL object
moc\del. But when I send HTML code to Outlook, the HTML tags all
appear in the body of the message instead of being converted to
readable format. I DO have Outlook set up to default to HTML for new
messages.

Any suggestions?

--WC

On 6 Sep 2003 15:13:33 -0700, pi********@hotmail.com (Pieter Linden)
wrote:
MLH <CR**@NorthState.net> wrote in message news:<gk********************************@4ax.com>. ..
I print to a device that creates a PDF. Knowing the filename, how can
I then embed the PDF into the body text of an OutLook Express outbound
email & send to a specified address in a table? I want recipient
addressees to see the report in the body text window of their email
when they open it. I was thinking also about attaching the PDF file to
the eMail for those having "text only" email software. I need to
automate both of these tasks from a VB procedure. IDEAS?


Express does not expose any objects, so you cannot automate it
directly. You might be able to do it using the CDO libraries or
something. You should be able to find something like that at the MS
website. Look for something like "CDONTS.DLL". If I remember right,
it's just a MAPI wrapper, so it should work. Then once you have that
installed and registered, doing what you ask is trivial.

In a sub/function do the following:
Create a new mail message.
Specify the body text. Not sure how you'd paste in the PDF, though.
If you were adding normal text, it would be a snap.
Add any attachments you want. (the PDF)
specify the recipients... open a recordset of recipients inside your
function (or pass it in as an argument), then loop through them adding
them to the Recipients collection.
When everything is the way you want it, issue the .Send command of the
message object.


Nov 12 '05 #5
On Sat, 06 Sep 2003 23:31:14 GMT, Chuck Grimsby
<c.*******@worldnet.att.net.invalid> wrote:

Chuck,

Thanks tons for your prolific effort here. I am remiss in allowing
you to think it was more complicated than it was. As it turns out,
all I had to do was to change the .body property to the .HTMLBody
property and wham -- it worked like a champ! I always feel a little
foolish when I discover a solution after I've been stumped for a
while. After 22 years in the IT business, I still get stumped by
these computers now and then.

The only way to do this William, is to "build" a HTML page on your
drive (preferably in the *user's* temp directory), then read it back
in as a string to place in the .Body property of the OutLook message.
You may want to visit http://www.slipstick.com/ for some examples.
(It's been a while since I've been there, so I'm not certain that they
have any, but they used to. CDOHelp.org used have code samples as
well, and probably the *best* set of examples of how to do anything
with Outlook, but they seem to be gone now.)

A far simpler way to do this would be to build your own SMTP server in
Access so you don't have to bother with the user's EMail program at
all. Search this newsgroup at Google for SMTP and you'll find code
that I've posted in the past that does this. (It's very simple,
actually! I just hate posting the same code over and over again...)

If you're unfamiliar with creating valid HTML pages, find someone who
is, who can hopefully build you a "example" page that you can use as a
template. (If you have to build this yourself, visit
http://www.htmlgoodies.com/ for help in how to do basic web pages.
It's a great beginner's site.)

You will have to also .Attachment the PDF file, and any graphic images
you want to appear as well.

With the above in mind, I want to caution you about a few things.
First (if you insist on using OutLook), make sure your EMail server
will allow you to send files as large as you are going to be sending
out. Not all EMail servers do! Nor do all EMail servers allow
*incoming* messages that are over a certain size.

Some EMail servers won't allow HTML messages of any kind due to all
the viruses that target OutLook users. Turning off HTML EMail is
usually the safest (and cheapest) way to deal with the virus problem,
so it's becoming more and more popular. Some users turn this off
themselves as well.

Lastly, if the information you are sending out is in *any* way
confidential, remember that EMail is *NOT* secure in any way, shape or
form. Unless the PDF file you are sending is Read password protected
(the user has to type in a password to see what's in the file), you
could not only be breaking several laws, but also be setting yourself
(and/or your company) up for quite a lawsuit which you will have no
hope whatsoever of winning.

On Sat, 06 Sep 2003 17:26:02 -0500, William Case <No@address.com>
wrote:
Pieter, Thanks for this response. I have a similar challenge, except
that all I want to do is insert and HTML encoded message into Outlook
in such a way that the HTML is rendered properly for display when the
message is sent, just like it would be if you switched to HTML mode in
Outlook (not Outlook Express) and entered the message manually
complete with all formatting, colors, fonts, etc. Right now I'm able
to send text messages (including HTML code to Outlook from an Access
2K procedure that uses late binding to manipulate the OL object
moc\del. But when I send HTML code to Outlook, the HTML tags all
appear in the body of the message instead of being converted to
readable format. I DO have Outlook set up to default to HTML for new
messages.

On 6 Sep 2003 15:13:33 -0700, pi********@hotmail.com (Pieter Linden)
wrote:

MLH <CR**@NorthState.net> wrote in message news:<gk********************************@4ax.com>. ..
I print to a device that creates a PDF. Knowing the filename, how can
I then embed the PDF into the body text of an OutLook Express outbound
email & send to a specified address in a table? I want recipient
addressees to see the report in the body text window of their email
when they open it. I was thinking also about attaching the PDF file to
the eMail for those having "text only" email software. I need to
automate both of these tasks from a VB procedure. IDEAS?Express does not expose any objects, so you cannot automate it
directly. You might be able to do it using the CDO libraries or
something. You should be able to find something like that at the MS
website. Look for something like "CDONTS.DLL". If I remember right,
it's just a MAPI wrapper, so it should work. Then once you have that
installed and registered, doing what you ask is trivial.In a sub/function do the following:
Create a new mail message.
Specify the body text. Not sure how you'd paste in the PDF, though.
If you were adding normal text, it would be a snap.
Add any attachments you want. (the PDF)
specify the recipients... open a recordset of recipients inside your
function (or pass it in as an argument), then loop through them adding
them to the Recipients collection.
When everything is the way you want it, issue the .Send command of the
message object.


Nov 12 '05 #6
You can do this easily with Outlook.
Outlook Express doesn't support vba.

Do you have Outlook?
Do you want sample code for Outlook?

Geoff

See www.slipstick.com
Nov 12 '05 #7
William Case <No@address.com> wrote:
As it turns out,
all I had to do was to change the .body property to the .HTMLBody
property and wham -- it worked like a champ!


I want you to know that I posted my previous reply before I looked down to see this
posting. <smile>

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 12 '05 #8
On Sun, 07 Sep 2003 02:49:41 GMT, Tony Toews <tt****@telusplanet.net>
wrote:
William Case <No@address.com> wrote:
Tony, Thanks for this response. I have a similar challenge, except
that all I want to do is insert and HTML encoded message into Outlook
in such a way that the HTML is rendered properly for display when the
message is sent, just like it would be if you switched to HTML mode in
Outlook and entered the message manually complete with all formatting,
colors, fonts, etc. Right now I'm able to send text messages
(including HTML code to Outlook from an Access 2K procedure that uses
late binding to manipulate the OL object moc\del. But when I send
HTML code to Outlook, the HTML tags all appear in the body of the
message instead of being converted to readable format. I DO have
Outlook set up to default to HTML for new messages.

Any suggestions?


An excellent question. <insert sounds of hemming and hawwing> That is a question
I've meant to find an answer to myself have haven't yet bothered as I haven't
required it.

Hmm, when I look at the source for a HTML email I see the following in the body.

<x-html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
.... etc.
</html>
</x-html>

Is it sufficient to put that in there?

No that isn't. The difference is in the header. The plain text email has
Content-Type: text/plain; charset="us-ascii"; format=flowed
while the HTLM email has:
Content-Type: multipart/alternative;
boundary="=====================_164560275==_.ALT"

And you can only manipulate headers by using whatever attributes you can access via
automation or whatever. Not by changing the body of the text.

Hmm, so there is likely some kinda Outlook setting which explicitly states that this
email will be sent as HTML.

Aha, yes there is. HTMLBody.
Thanks for your excellent contributions to this group.


Thanks for your comments. They make the effort worthwhile.

Tony


Thanks again Tony. I discovered this property with help from another
MVP just about two hours before seeing this message. I don't know why
I overlooked it before except that I've never NEEDED it before and I
did not know what string to search for in the Object Browser. I tried
it and it works like a champ.
Nov 12 '05 #9
MLH
Unfortunately, I'm locked into doing this with
outlook express. I can, however, settle for the
attachment. And, yes! I would really appreciate
the sample code for automating the sending
process of some cut 'n paste body text and
an attachment.

If its not too much code to post here, that is.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

On Sat, 6 Sep 2003 18:55:18 +0100, "Geoff"
<ge***@NOggppSPAM.fsnet.co.uk> wrote:
You can do this easily with Outlook.
Outlook Express doesn't support vba.

Do you have Outlook?
Do you want sample code for Outlook?

Geoff

See www.slipstick.com


Nov 12 '05 #10
MLH <CR**@NorthState.net> wrote:
Unfortunately, I'm locked into doing this with
outlook express. I can, however, settle for the
attachment. And, yes! I would really appreciate
the sample code for automating the sending
process of some cut 'n paste body text and
an attachment.


There's some links to MAPI code at the Access Email FAQ at my website.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 12 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Daniel | last post by:
when writing out a file from .net, when is the file created? after the bytes are all written to the hard drive or before the bytes are written to the hard drive?
2
by: Robizzle | last post by:
Sorry, I must be blind but I can't seem to find it anywhere. What function will return the time a file was created? I see filemtime(...) returns the time that file was last Modified and...
11
by: Grim Reaper | last post by:
I am importing a .csv file into Access that has 37 fields. My problem is that sometimes the last field only has data at the end of the column (it looks like when you import a file into Access, for...
4
by: Oliver Knoll | last post by:
According to my ANSI book, tmpfile() creates a file with wb+ mode (that is just writing, right?). How would one reopen it for reading? I got the following (which works): FILE *tmpFile =...
1
by: lsemos58 | last post by:
How can I restore the .bak file created while using wrkgadm.exe to create a new workgroup information file. Luane
3
by: pnsreee | last post by:
Hi All, I am trying to print a log file created in the same script with the code bellow. but Im not getting output on screen. The output file is created using rediretion of output. ...
6
by: Filips Benoit | last post by:
Dear All, All 3 codes, copied from internet, triggers error 429 : ActiveX component can't create object ! No compile error. I have the reference set to Adobe Acrobat 7.0 Type Library I do not...
4
by: ramaswamynanda | last post by:
Hello All, I created an application using Ms Access 2000. My client has Access 2003. When I shipped him the code, this problem occured. He took the following actions - 1. double click on mdb...
4
by: Aniasp | last post by:
I am new to ASP. Request you to tell me how I could save .gif/.doc file in Access table from ASP. Please let me know complete solution including Datatype required to set in Access table & ASP code...
2
by: tulasisridhar | last post by:
Hi All, I have binary file created in Unix I now need to read it using VB.net and doo some procesing. There is some conversion between bigendian and little endians. I know the structure...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.