PC Review


Reply
Thread Tools Rate Thread

How to create the sent mail in SendItems folder???

 
 
=?Utf-8?B?TXVzTW91?=
Guest
Posts: n/a
 
      1st Oct 2005
I´m using Access 2000 to generate a file from the database and then I
send it as an attachement to the mail using the following code witch works
perfectly:
Dim iMsg As Object
Dim iConf As Object
Dim iBP
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")

With iMsg
Set .Configuration = iConf
.To = "(E-Mail Removed)"
.From = """Darivan"" <(E-Mail Removed)>"
.Subject = "Darivan Reklam (Fakturafil) "
.HTMLBody ="<html> some text here</html>"
Set iBP = iMsg.AddAttachment("C:\Reklam_" & Me!Date.Value &
".txt")
.Send
End With

Set iBP = Nothing
Set iMsg = Nothing
Set iConf = Nothing

Can I get a simple code to create the sent mail in SentItems folder with the
attachement file as if it was sent from Outlook?

So please help me get started
thank you

 
Reply With Quote
 
 
 
 
David C. Holley
Guest
Posts: n/a
 
      1st Oct 2005
I do know that when you use Outlook Object Model to send the email as in

Dim appOutlook as Outlook.Application
Dim newMail As MailItem

Set objOutlook = CreateObject("Outlook.application")
Set newAppt = objOutlook.CreateItem(olAppointmentItem)

with newAppt
.Send
end with

objOutlook.Quit
set newAppt = Nothing
set objOutlook = Nothing


Outlook will save a copy in the Sent Items folder, provided that the
Option is selected in the Options Dialog.

TOOLS > OPTIONS > PREFERENCES > EMAIL OPTIONS

Save Copies of messages in Sent Items Folder.

I'm not the expert on where CDO fits into things, however I would first
check that setting and try the code then. If it still doesn't capture
it, I would convert to using Outlook as shown above. The properties of
MailItem are essentially the same as a Message in CDO, plus probably a
few more.

MusMou wrote:
> I´m using Access 2000 to generate a file from the database and then I
> send it as an attachement to the mail using the following code witch works
> perfectly:
> Dim iMsg As Object
> Dim iConf As Object
> Dim iBP
> Set iMsg = CreateObject("CDO.Message")
> Set iConf = CreateObject("CDO.Configuration")
>
> With iMsg
> Set .Configuration = iConf
> .To = "(E-Mail Removed)"
> .From = """Darivan"" <(E-Mail Removed)>"
> .Subject = "Darivan Reklam (Fakturafil) "
> .HTMLBody ="<html> some text here</html>"
> Set iBP = iMsg.AddAttachment("C:\Reklam_" & Me!Date.Value &
> ".txt")
> .Send
> End With
>
> Set iBP = Nothing
> Set iMsg = Nothing
> Set iConf = Nothing
>
> Can I get a simple code to create the sent mail in SentItems folder with the
> attachement file as if it was sent from Outlook?
>
> So please help me get started
> thank you
>

 
Reply With Quote
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      3rd Oct 2005
Not if you use Simple MAPI as you are. You'd need to use CDO 1.21 instead,
however that would fire the security prompts. Simple MAPI has no connection
to Outlook and you can't control where the item is stored using that API.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"MusMou" <(E-Mail Removed)> wrote in message
news:473774C7-AD25-4527-BEB3-(E-Mail Removed)...
> I´m using Access 2000 to generate a file from the database and then I
> send it as an attachement to the mail using the following code witch works
> perfectly:
> Dim iMsg As Object
> Dim iConf As Object
> Dim iBP
> Set iMsg = CreateObject("CDO.Message")
> Set iConf = CreateObject("CDO.Configuration")
>
> With iMsg
> Set .Configuration = iConf
> .To = "(E-Mail Removed)"
> .From = """Darivan"" <(E-Mail Removed)>"
> .Subject = "Darivan Reklam (Fakturafil) "
> .HTMLBody ="<html> some text here</html>"
> Set iBP = iMsg.AddAttachment("C:\Reklam_" & Me!Date.Value &
> ".txt")
> .Send
> End With
>
> Set iBP = Nothing
> Set iMsg = Nothing
> Set iConf = Nothing
>
> Can I get a simple code to create the sent mail in SentItems folder with
> the
> attachement file as if it was sent from Outlook?
>
> So please help me get started
> thank you
>


 
Reply With Quote
 
=?Utf-8?B?TXVzTW91?=
Guest
Posts: n/a
 
      3rd Oct 2005
Hi Ken,

What would be the solution?
I heard about Redemption but there was no dokumentation as a download.
If possible the code needed to acomplish the task (send a mail and save it
in SendItems).
best reguards
Mustapha

"Ken Slovak - [MVP - Outlook]" skrev:

> Not if you use Simple MAPI as you are. You'd need to use CDO 1.21 instead,
> however that would fire the security prompts. Simple MAPI has no connection
> to Outlook and you can't control where the item is stored using that API.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
> Reminder Manager, Extended Reminders, Attachment Options
> http://www.slovaktech.com/products.htm
>
>
> "MusMou" <(E-Mail Removed)> wrote in message
> news:473774C7-AD25-4527-BEB3-(E-Mail Removed)...
> > I´m using Access 2000 to generate a file from the database and then I
> > send it as an attachement to the mail using the following code witch works
> > perfectly:
> > Dim iMsg As Object
> > Dim iConf As Object
> > Dim iBP
> > Set iMsg = CreateObject("CDO.Message")
> > Set iConf = CreateObject("CDO.Configuration")
> >
> > With iMsg
> > Set .Configuration = iConf
> > .To = "(E-Mail Removed)"
> > .From = """Darivan"" <(E-Mail Removed)>"
> > .Subject = "Darivan Reklam (Fakturafil) "
> > .HTMLBody ="<html> some text here</html>"
> > Set iBP = iMsg.AddAttachment("C:\Reklam_" & Me!Date.Value &
> > ".txt")
> > .Send
> > End With
> >
> > Set iBP = Nothing
> > Set iMsg = Nothing
> > Set iConf = Nothing
> >
> > Can I get a simple code to create the sent mail in SentItems folder with
> > the
> > attachement file as if it was sent from Outlook?
> >
> > So please help me get started
> > thank you
> >

>
>

 
Reply With Quote
 
David C. Holley
Guest
Posts: n/a
 
      4th Oct 2005
See my prior post for 1 option.

MusMou wrote:
> Hi Ken,
>
> What would be the solution?
> I heard about Redemption but there was no dokumentation as a download.
> If possible the code needed to acomplish the task (send a mail and save it
> in SendItems).
> best reguards
> Mustapha
>
> "Ken Slovak - [MVP - Outlook]" skrev:
>
>
>>Not if you use Simple MAPI as you are. You'd need to use CDO 1.21 instead,
>>however that would fire the security prompts. Simple MAPI has no connection
>>to Outlook and you can't control where the item is stored using that API.
>>
>>--
>>Ken Slovak
>>[MVP - Outlook]
>>http://www.slovaktech.com
>>Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
>>Reminder Manager, Extended Reminders, Attachment Options
>>http://www.slovaktech.com/products.htm
>>
>>
>>"MusMou" <(E-Mail Removed)> wrote in message
>>news:473774C7-AD25-4527-BEB3-(E-Mail Removed)...
>>
>>>I´m using Access 2000 to generate a file from the database and then I
>>>send it as an attachement to the mail using the following code witch works
>>>perfectly:
>>> Dim iMsg As Object
>>> Dim iConf As Object
>>> Dim iBP
>>> Set iMsg = CreateObject("CDO.Message")
>>> Set iConf = CreateObject("CDO.Configuration")
>>>
>>> With iMsg
>>> Set .Configuration = iConf
>>> .To = "(E-Mail Removed)"
>>> .From = """Darivan"" <(E-Mail Removed)>"
>>> .Subject = "Darivan Reklam (Fakturafil) "
>>> .HTMLBody ="<html> some text here</html>"
>>> Set iBP = iMsg.AddAttachment("C:\Reklam_" & Me!Date.Value &
>>>".txt")
>>> .Send
>>> End With
>>>
>>> Set iBP = Nothing
>>> Set iMsg = Nothing
>>> Set iConf = Nothing
>>>
>>>Can I get a simple code to create the sent mail in SentItems folder with
>>>the
>>>attachement file as if it was sent from Outlook?
>>>
>>>So please help me get started
>>>thank you
>>>

>>
>>

 
Reply With Quote
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      4th Oct 2005
There are many samples at the Redemption Web site that cover situations such
as yours.

If the user has set to have sent items moved to the Sent Items folder that
part's automatic. Here's what Redemption code would look like for doing what
you want:

Dim oMail As Outlook.MailItem
Dim safMail As Redemption.SafeMailItem
Dim oNS As Outlook.NameSpace
Dim oOL As Outlook.Application

Set oOL = CreateObject("Outlook.Application")
Set oNS = oOL.Session
oNS.Logon

Set oMail = oOL.CreateItem(olMailItem)
With oMail
.Subject = "Darivan Reklam (Fakturafil) "
.HTMLBody ="<html> some text here</html>"
.Attachments.Add "C:\Reklam_" & Me!Date.Value & ".txt"
.Save
End With

Set SafMail = CreateObject("Redemption.SafeMailItem")
safMail.Item = oMail
With safMail
.Recipients.Add "(E-Mail Removed)"
.Recipients.ResolveAll
.Send
End With

' release all objects here

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"MusMou" <(E-Mail Removed)> wrote in message
news:39915020-2BC0-4AE5-96D5-(E-Mail Removed)...
> Hi Ken,
>
> What would be the solution?
> I heard about Redemption but there was no dokumentation as a download.
> If possible the code needed to acomplish the task (send a mail and save it
> in SendItems).
> best reguards
> Mustapha


 
Reply With Quote
 
David C. Holley
Guest
Posts: n/a
 
      4th Oct 2005
For that matter if you're using the Outlook.Application object why not
just use

Set newMailItem = oOL.CreateItem(olMailItem)

and then
newMailItem.send

David H

Ken Slovak - [MVP - Outlook] wrote:
> There are many samples at the Redemption Web site that cover situations
> such as yours.
>
> If the user has set to have sent items moved to the Sent Items folder
> that part's automatic. Here's what Redemption code would look like for
> doing what you want:
>
> Dim oMail As Outlook.MailItem
> Dim safMail As Redemption.SafeMailItem
> Dim oNS As Outlook.NameSpace
> Dim oOL As Outlook.Application
>
> Set oOL = CreateObject("Outlook.Application")
> Set oNS = oOL.Session
> oNS.Logon
>
> Set oMail = oOL.CreateItem(olMailItem)
> With oMail
> .Subject = "Darivan Reklam (Fakturafil) "
> .HTMLBody ="<html> some text here</html>"
> .Attachments.Add "C:\Reklam_" & Me!Date.Value & ".txt"
> .Save
> End With
>
> Set SafMail = CreateObject("Redemption.SafeMailItem")
> safMail.Item = oMail
> With safMail
> .Recipients.Add "(E-Mail Removed)"
> .Recipients.ResolveAll
> .Send
> End With
>
> ' release all objects here
>

 
Reply With Quote
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      5th Oct 2005
The Send method is restricted and will bring up the security prompts even in
Outlook 2003 if the code is not running in a trusted Outlook COM addin.
That's why Redemption is used. Outlook 2002 and earlier don't have trusted
COM addins at all, other than when set using the Exchange security form.
Therefore they need to use Redemption or some equivalent.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"David C. Holley" <(E-Mail Removed)> wrote in message
news:OkMWl$(E-Mail Removed)...
> For that matter if you're using the Outlook.Application object why not
> just use
>
> Set newMailItem = oOL.CreateItem(olMailItem)
>
> and then
> newMailItem.send
>
> David H


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to create folder with subject line and save the mail in that folder ramserp Microsoft Outlook VBA Programming 0 19th Mar 2010 07:26 AM
Junk E-mail folder - is there a way to create a rule to delete items in this folder older than X days? Jaycee Microsoft Outlook 1 22nd Feb 2006 04:54 PM
how to create a sub-folder under a mail folder =?Utf-8?B?YXRzYW5n?= Microsoft Outlook Discussion 1 8th Jul 2005 05:00 PM
how do i create two mail folder for two different mail account =?Utf-8?B?UmFqZXNoIEd1cHRh?= Microsoft Outlook Discussion 1 22nd Apr 2005 04:33 PM
how do i create two mail folder for two different mail account =?Utf-8?B?UmFqZXNoIFNhaA==?= Microsoft Outlook Discussion 0 22nd Apr 2005 05:26 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:41 AM.