If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > E-Mail appendix

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-27-03, 06:26
vestigo vestigo is offline
Senior Member
 
Join Date: Nov 2002
Location: Norway
Posts: 239
Question E-Mail appendix

Hi.

I need to a attach a PDF file to a automatic generated e-mail from MS-Access. Can anyone help ? (Access XP)

I tryed the "DoCmd.SendObject" command, but this one only allow me to attach HTML, text, Excel ... files.

Thanks a lot.
Reply With Quote
  #2 (permalink)  
Old 01-27-03, 07:54
m.timoney m.timoney is offline
Registered User
 
Join Date: Oct 2002
Location: Leicester - UK
Posts: 819
try using outlook or express,

i used this code to read emails from outlook so i should imagine that you can send this way as well

Sub getMail()
Dim inboxcontense As Outlook.Items, email As MailItem
Dim rs As DAO.Recordset
Set inboxcontense = CreateObject("Outlook.Application").GetNamespace(" MAPI").GetDefaultFolder(olFolderInbox).Items
Set rs = CurrentDb.OpenRecordset("jobs", , dbAppendOnly)
For Each email In inboxcontense
With rs
.AddNew
!User = email.SenderName
!DateReported = email.SentOn
!DescriptionBrief = email.Subject
!DescriptionFull = email.Body
!Status = 1
.update
End With
email.Delete
Next
rs.Close
End Sub
__________________
Definition of a Beginner, Someone who doesn't know the rules.

Definition of an Expert, Someone who knows when to ignore the rules.
Reply With Quote
  #3 (permalink)  
Old 01-27-03, 15:51
playernovis playernovis is offline
Registered User
 
Join Date: Nov 2002
Location: San Francisco
Posts: 251

Set objOutlk = CreateObject("Outlook.Application")
Set objMail = objOutlk.createitem(olMailItem)
strMsg = "This is the first line of the email body!" & vbCrLf
strMsg = strMsg & "This is the second line of the email body!" & vbCrLf

With objMail
.To = "me@domain1.com; me2@domain4.com"
.cc = "me3@domain3.com"
.subject = "Test email"
.body = strMsg
.attachments.add("c:\blabla.zip")
.Send
End With



this works under Outlook. If you need the code for LOTUS NOTES or Outlook Express, let me know.

note: if you have OutlookXP or Outlook with Security update, you will get popup message..... I posted few weeks ago message how to go around....



jiri

Last edited by playernovis; 01-27-03 at 15:56.
Reply With Quote
  #4 (permalink)  
Old 01-28-03, 02:22
vestigo vestigo is offline
Senior Member
 
Join Date: Nov 2002
Location: Norway
Posts: 239
Smile Lotus Notes appendix

The final solution will be used under Lotus Notes, but my developer version need to be tested in Outlook. I have not tryed your proposal yet, but it look promising.

Thanks a lot.
Reply With Quote
  #5 (permalink)  
Old 01-28-03, 11:48
playernovis playernovis is offline
Registered User
 
Join Date: Nov 2002
Location: San Francisco
Posts: 251
Lotus Notes has it's own API ... I just finished small project on posting documents to Lotus Notes Library....

try this:

http://www-10.lotus.com/ldd/today.ns...4?OpenDocument


I had to use instead of
CreateObject("Lotus.NotesSession")
this
CreateObject("Notes.NotesSession")

and that's wahy I could not use some properties..... I hate LOTUS NOTES!


so my final EMAIL looks like this:


Dim Resp As Integer
Dim Server As String
Dim UserDef As String
Dim DefFile As String
Dim NOTESSESSION As Object
Dim NOTESDATABASE As Object
Dim NOTESDOCUMENT As Object
Dim NotesRichText As Object

Server = "MYLOTUSSERVER"
UserDef = "MAIL\myname.nsf"

Set NOTESSESSION = CreateObject("Notes.NotesSession")
Set NOTESDATABASE = NOTESSESSION.GetDatabase(Server, UserDef)

Set NOTESDOCUMENT = NOTESDATABASE.CreateDocument
Set NotesRichText = NOTESDOCUMENT.CreateRichTextItem("Body")

NOTESDOCUMENT.Subject = "test"
NOTESDOCUMENT.body = "this is very small test"
NOTESDOCUMENT.CreateRichTextItem("Attachment").Emb edObject 1454, "", "c:\myfile.txt", "attachment"
NOTESDOCUMENT.SendTo = "myemail@yahoo.com"

NOTESDOCUMENT.SaveMessageOnSend = False
NOTESDOCUMENT.Send False


jiri
Reply With Quote
  #6 (permalink)  
Old 01-28-03, 14:36
vestigo vestigo is offline
Senior Member
 
Join Date: Nov 2002
Location: Norway
Posts: 239
Angry Appendix in Outlook was OK

Hi playernovis

I tryed your proposal using Outlook. It works fine. Thanks !

Now I will try your Notet proposal, that will be an challenge as I have no Notes currently installed on my PC.

I'll let you know.


vestigo
Reply With Quote
  #7 (permalink)  
Old 01-31-03, 12:08
m.timoney m.timoney is offline
Registered User
 
Join Date: Oct 2002
Location: Leicester - UK
Posts: 819
i gave the solusion a try as well and came up against an odd problem, on completion of the code the email excists in the outlook outbox but isn't sent any idea why?
__________________
Definition of a Beginner, Someone who doesn't know the rules.

Definition of an Expert, Someone who knows when to ignore the rules.
Reply With Quote
  #8 (permalink)  
Old 01-31-03, 13:30
vestigo vestigo is offline
Senior Member
 
Join Date: Nov 2002
Location: Norway
Posts: 239
Angry Use Outlook as alternative to Notes mail

In order to test mr. "playernovis " proposal I need to download a demo version of Notes. During the weekend I will spend some time to do further investigations. As an option I will try to use Outlook as an alternative, even if Notes is the preferred mailing system. I'll let you know the results next week.

Vestigo
Reply With Quote
  #9 (permalink)  
Old 02-03-03, 05:17
m.timoney m.timoney is offline
Registered User
 
Join Date: Oct 2002
Location: Leicester - UK
Posts: 819
what ever the problem was it seems to have cured it's self very odd
__________________
Definition of a Beginner, Someone who doesn't know the rules.

Definition of an Expert, Someone who knows when to ignore the rules.
Reply With Quote
  #10 (permalink)  
Old 02-03-03, 06:13
m.timoney m.timoney is offline
Registered User
 
Join Date: Oct 2002
Location: Leicester - UK
Posts: 819
okay any ideas on how to chooses a profile to use when theres a choice?
__________________
Definition of a Beginner, Someone who doesn't know the rules.

Definition of an Expert, Someone who knows when to ignore the rules.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On