A Microsoft Outlook email forum. Outlook Banter

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   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Tags: , , ,

Redemption emails to draft folder





 
 
Thread Tools Display Modes
  #1  
Old June 14th 06, 02:09 PM posted to microsoft.public.outlook.program_addins
simonkue
external usenet poster
 
Posts: 4
Default Redemption emails to draft folder

I have a VB6 pgm that used to generate outlook e-mails correctly prior to
v2002. Now I need Redemption. I can generate the e-mail but it goes to the
drafts folder and not directly to the Outbox. I can copy from Draft to Outbox
but it is not ready to be sent and needs to be individually entered and sent.
I should be able to generate e-mail directly to the Outbox. What am I doing
wrong?
Using Win2k and XP, Outlook 2k and 2002 - same results.
The following code is a routine called for each e-mail so that there is only
1 To and no cc or bcc per e-mail.

Function CreateMail(xsRecip As Variant, xsSubject As String, xsMsg As
String, _
Optional xsAttachments As String) As Boolean

' Create new e-mail

Dim xvRecip As Variant
Dim xvAttach As Variant
Dim xbResolveOK As Boolean
Dim xnLen As Integer

Dim oMailItem As Object
Dim oMail As Object

Dim myNameSpace As NameSpace
Dim myFolder As Object

Dim SafeItem, oItem

On Error GoTo CreateMail_Err

' Get the message text. If xsMsg=Clipboard, then that is where the text is
If xsMsg = "Clipboard" Then
xsMsg = Clipboard.GetText
End If

xnLen = Len(xsMsg) + 1

Set Application = CreateObject("Outlook.Application")
Set myNameSpace = Application.GetNamespace("MAPI")
myNameSpace.Logon
Set myFolder = myNameSpace.GetDefaultFolder(4) 'olFolderOutbox

Set SafeItem = CreateObject("Redemption.SafeMailItem")
Set oItem = Application.CreateItem(olMailItem)
SafeItem.Item = oItem

With SafeItem
.Item = oItem
.Recipients.Add xsRecip
xbResolveOK = .Recipients.ResolveAll

' Note that the attachment must have the full file path. File name alone
isn't good enough!

If Not IsMissing(xsAttachments) And xsAttachments "" Then
.Attachments.Add xsAttachments, olByValue, xnLen, "Enclosed file"
End If
.Subject = xsSubject
.Body = xsMsg
If xbResolveOK Then
On Error GoTo 0
.Save
.ExpiryTime = .CreationTime
' .Send
.CopyTo myFolder
Else
MsgBox "Unable to resolve recipient. Please check " & xsRecip
.Display
End If
End With

CreateMail = True

'Set oMailItem = Nothing
'Set orSafeMailItem = Nothing
'Set xgolApp = Nothing
'
CreateMail_End:
Exit Function

CreateMail_Err:
CreateMail = False
Resume CreateMail_End
End Function


Ads
  #2  
Old June 14th 06, 02:35 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 3,411
Default Redemption emails to draft folder

That's what always happens, don't worry about it. The mail item doesn't have
to be in Outbox to go out. Just call Send on the item and then if you want
it out immediately either call DeliverNow or use code to click the
Send/Receive or Send/Receive All menu commands. There's a sample for that in
the Redemption FAQ.

--
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


"simonkue" wrote in message
...
I have a VB6 pgm that used to generate outlook e-mails correctly prior to
v2002. Now I need Redemption. I can generate the e-mail but it goes to the
drafts folder and not directly to the Outbox. I can copy from Draft to
Outbox
but it is not ready to be sent and needs to be individually entered and
sent.
I should be able to generate e-mail directly to the Outbox. What am I
doing
wrong?
Using Win2k and XP, Outlook 2k and 2002 - same results.
The following code is a routine called for each e-mail so that there is
only
1 To and no cc or bcc per e-mail.

Function CreateMail(xsRecip As Variant, xsSubject As String, xsMsg As
String, _
Optional xsAttachments As String) As Boolean

' Create new e-mail

Dim xvRecip As Variant
Dim xvAttach As Variant
Dim xbResolveOK As Boolean
Dim xnLen As Integer

Dim oMailItem As Object
Dim oMail As Object

Dim myNameSpace As NameSpace
Dim myFolder As Object

Dim SafeItem, oItem

On Error GoTo CreateMail_Err

' Get the message text. If xsMsg=Clipboard, then that is where the text
is
If xsMsg = "Clipboard" Then
xsMsg = Clipboard.GetText
End If

xnLen = Len(xsMsg) + 1

Set Application = CreateObject("Outlook.Application")
Set myNameSpace = Application.GetNamespace("MAPI")
myNameSpace.Logon
Set myFolder = myNameSpace.GetDefaultFolder(4) 'olFolderOutbox

Set SafeItem = CreateObject("Redemption.SafeMailItem")
Set oItem = Application.CreateItem(olMailItem)
SafeItem.Item = oItem

With SafeItem
.Item = oItem
.Recipients.Add xsRecip
xbResolveOK = .Recipients.ResolveAll

' Note that the attachment must have the full file path. File name alone
isn't good enough!

If Not IsMissing(xsAttachments) And xsAttachments "" Then
.Attachments.Add xsAttachments, olByValue, xnLen, "Enclosed file"
End If
.Subject = xsSubject
.Body = xsMsg
If xbResolveOK Then
On Error GoTo 0
.Save
.ExpiryTime = .CreationTime
' .Send
.CopyTo myFolder
Else
MsgBox "Unable to resolve recipient. Please check " & xsRecip
.Display
End If
End With

CreateMail = True

'Set oMailItem = Nothing
'Set orSafeMailItem = Nothing
'Set xgolApp = Nothing
'
CreateMail_End:
Exit Function

CreateMail_Err:
CreateMail = False
Resume CreateMail_End
End Function



  #3  
Old June 14th 06, 08:58 PM posted to microsoft.public.outlook.program_addins
simonkue
external usenet poster
 
Posts: 4
Default Redemption emails to draft folder

Sorry - posted this duplicate entry by mistake! Please ignore this copy

"simonkue" wrote:

I have a VB6 pgm that used to generate outlook e-mails correctly prior to
v2002. Now I need Redemption. I can generate the e-mail but it goes to the
drafts folder and not directly to the Outbox. I can copy from Draft to Outbox
but it is not ready to be sent and needs to be individually entered and sent.
I should be able to generate e-mail directly to the Outbox. What am I doing
wrong?
Using Win2k and XP, Outlook 2k and 2002 - same results.
The following code is a routine called for each e-mail so that there is only
1 To and no cc or bcc per e-mail.

Function CreateMail(xsRecip As Variant, xsSubject As String, xsMsg As
String, _
Optional xsAttachments As String) As Boolean

' Create new e-mail

Dim xvRecip As Variant
Dim xvAttach As Variant
Dim xbResolveOK As Boolean
Dim xnLen As Integer

Dim oMailItem As Object
Dim oMail As Object

Dim myNameSpace As NameSpace
Dim myFolder As Object

Dim SafeItem, oItem

On Error GoTo CreateMail_Err

' Get the message text. If xsMsg=Clipboard, then that is where the text is
If xsMsg = "Clipboard" Then
xsMsg = Clipboard.GetText
End If

xnLen = Len(xsMsg) + 1

Set Application = CreateObject("Outlook.Application")
Set myNameSpace = Application.GetNamespace("MAPI")
myNameSpace.Logon
Set myFolder = myNameSpace.GetDefaultFolder(4) 'olFolderOutbox

Set SafeItem = CreateObject("Redemption.SafeMailItem")
Set oItem = Application.CreateItem(olMailItem)
SafeItem.Item = oItem

With SafeItem
.Item = oItem
.Recipients.Add xsRecip
xbResolveOK = .Recipients.ResolveAll

' Note that the attachment must have the full file path. File name alone
isn't good enough!

If Not IsMissing(xsAttachments) And xsAttachments "" Then
.Attachments.Add xsAttachments, olByValue, xnLen, "Enclosed file"
End If
.Subject = xsSubject
.Body = xsMsg
If xbResolveOK Then
On Error GoTo 0
.Save
.ExpiryTime = .CreationTime
' .Send
.CopyTo myFolder
Else
MsgBox "Unable to resolve recipient. Please check " & xsRecip
.Display
End If
End With

CreateMail = True

'Set oMailItem = Nothing
'Set orSafeMailItem = Nothing
'Set xgolApp = Nothing
'
CreateMail_End:
Exit Function

CreateMail_Err:
CreateMail = False
Resume CreateMail_End
End Function


  #4  
Old June 14th 06, 09:00 PM posted to microsoft.public.outlook.program_addins
simonkue
external usenet poster
 
Posts: 4
Default Redemption emails to draft folder

Ken, Thanks for your answer. I've tested this and this part is fine.
Has it always been the case that e-mails can be sent from "anywhere" in
Outlook? I assumed that they had to be in the Outbox to be picked up.

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

That's what always happens, don't worry about it. The mail item doesn't have
to be in Outbox to go out. Just call Send on the item and then if you want
it out immediately either call DeliverNow or use code to click the
Send/Receive or Send/Receive All menu commands. There's a sample for that in
the Redemption FAQ.

--
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


"simonkue" wrote in message
...
I have a VB6 pgm that used to generate outlook e-mails correctly prior to
v2002. Now I need Redemption. I can generate the e-mail but it goes to the
drafts folder and not directly to the Outbox. I can copy from Draft to
Outbox
but it is not ready to be sent and needs to be individually entered and
sent.
I should be able to generate e-mail directly to the Outbox. What am I
doing
wrong?
Using Win2k and XP, Outlook 2k and 2002 - same results.
The following code is a routine called for each e-mail so that there is
only
1 To and no cc or bcc per e-mail.

Function CreateMail(xsRecip As Variant, xsSubject As String, xsMsg As
String, _
Optional xsAttachments As String) As Boolean

' Create new e-mail

Dim xvRecip As Variant
Dim xvAttach As Variant
Dim xbResolveOK As Boolean
Dim xnLen As Integer

Dim oMailItem As Object
Dim oMail As Object

Dim myNameSpace As NameSpace
Dim myFolder As Object

Dim SafeItem, oItem

On Error GoTo CreateMail_Err

' Get the message text. If xsMsg=Clipboard, then that is where the text
is
If xsMsg = "Clipboard" Then
xsMsg = Clipboard.GetText
End If

xnLen = Len(xsMsg) + 1

Set Application = CreateObject("Outlook.Application")
Set myNameSpace = Application.GetNamespace("MAPI")
myNameSpace.Logon
Set myFolder = myNameSpace.GetDefaultFolder(4) 'olFolderOutbox

Set SafeItem = CreateObject("Redemption.SafeMailItem")
Set oItem = Application.CreateItem(olMailItem)
SafeItem.Item = oItem

With SafeItem
.Item = oItem
.Recipients.Add xsRecip
xbResolveOK = .Recipients.ResolveAll

' Note that the attachment must have the full file path. File name alone
isn't good enough!

If Not IsMissing(xsAttachments) And xsAttachments "" Then
.Attachments.Add xsAttachments, olByValue, xnLen, "Enclosed file"
End If
.Subject = xsSubject
.Body = xsMsg
If xbResolveOK Then
On Error GoTo 0
.Save
.ExpiryTime = .CreationTime
' .Send
.CopyTo myFolder
Else
MsgBox "Unable to resolve recipient. Please check " & xsRecip
.Display
End If
End With

CreateMail = True

'Set oMailItem = Nothing
'Set orSafeMailItem = Nothing
'Set xgolApp = Nothing
'
CreateMail_End:
Exit Function

CreateMail_Err:
CreateMail = False
Resume CreateMail_End
End Function




  #5  
Old June 14th 06, 09:45 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 3,411
Default Redemption emails to draft folder

Outlook places them in Outbox, Redemption and some other API's place them in
Drafts and they move through Outbox so quickly you don't see them shrug.
It doesn't prevent things from working correctly.

--
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


"simonkue" wrote in message
...
Ken, Thanks for your answer. I've tested this and this part is fine.
Has it always been the case that e-mails can be sent from "anywhere" in
Outlook? I assumed that they had to be in the Outbox to be picked up.


  #6  
Old June 14th 06, 10:36 PM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 1,518
Default Redemption emails to draft folder

Actually Redemption does not even try to move the message since doing so
will result in a ghost message. And by default Outlook creates new messages
in the Drafts folder.
You can explicitly move the item *before* using Redemption:

Set oItem = Application.CreateItem(olMailItem)
set oItem = oItem.Move(myFolder)

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Ken Slovak - [MVP - Outlook]" wrote in message
...
Outlook places them in Outbox, Redemption and some other API's place them
in Drafts and they move through Outbox so quickly you don't see them
shrug. It doesn't prevent things from working correctly.

--
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


"simonkue" wrote in message
...
Ken, Thanks for your answer. I've tested this and this part is fine.
Has it always been the case that e-mails can be sent from "anywhere" in
Outlook? I assumed that they had to be in the Outbox to be picked up.




  #7  
Old June 14th 06, 10:39 PM posted to microsoft.public.outlook.program_addins
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,568
Default Redemption emails to draft folder

So, what is it with moving items out of Drafts? I've heard of other people encountering these "ghost" messages when they try to do that.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Dmitry Streblechenko" wrote in message ...
Actually Redemption does not even try to move the message since doing so
will result in a ghost message. And by default Outlook creates new messages
in the Drafts folder.


  #8  
Old June 14th 06, 11:52 PM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 1,518
Default Redemption emails to draft folder

That happens if you use the old instance of the mesage that was supposed to
be immediately released:

OldMessage.Move(SomeFolder)
OldMessage.Whatever
OldMessage.Save

Boom! You got a ghost message in the old parent folder. Don't know if that
happens 100% of the time, but it certainly does happen. The right way to do
that is

set NewMessage = OldMessage.Move(SomeFolder)
NewMessage.Whatever
NewMessage.Save

And Redemption cannot do this silently under the covers because it has no
way of replacing the reference to the old message in the calling code. The
caller must do that explicitly first.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Sue Mosher [MVP-Outlook]" wrote in message
...
So, what is it with moving items out of Drafts? I've heard of other people
encountering these "ghost" messages when they try to do that.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Dmitry Streblechenko" wrote in message
...
Actually Redemption does not even try to move the message since doing so
will result in a ghost message. And by default Outlook creates new
messages
in the Drafts folder.



 




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to Move Mail Messages from Draft folder to other folders VBnovice Outlook and VBA 4 June 14th 06 07:10 PM
Help wanted Using redemption to see emails in CC,BCC and TO fields bobdydd Outlook and VBA 1 June 9th 06 10:11 PM
Contents of Draft Folder Missing ddlaz Outlook - Installation 1 June 9th 06 06:50 AM
outlook draft folder has small pencil icon scott Outlook - General Queries 3 June 9th 06 12:40 AM
Draft Folder problem Peter Brown Outlook - General Queries 1 May 17th 06 07:53 AM


All times are GMT +1. The time now is 10:20 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2008 Outlook Banter, part of the NewsgroupBanter project.
The comments are property of their posters.
Bad Credit Credit Cards - Tiling Forum - Car Loan - Money - Loans