Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending Outlook mail using Redemption

Status
Not open for further replies.

yeti

Programmer
Mar 22, 2001
33
GB
Hello,

I'm trying to use a simple vbscript to send an e-mail via outlook 2003. To get around the pop-up security warning message I'm using the "Redemption" COM library.

For a few days my code seemed to work - but now I get the following error message: Could not submit the message - error 0x80004005, Source: Redemption.SafeMailItem.

The message correctly appears in Outlook's 'drafts' folder - but does not get sent. Could this be because Redemption has not be registered properly?

Can anyone help? My short script is as follows:

Code:
set Application = CreateObject("Outlook.Application")
set Namespace = Application.GetNamespace("MAPI")
Namespace.Logon

dim SafeItem, oItem 
set SafeItem = CreateObject("Redemption.SafeMailItem")
set oItem = Application.CreateItem(0)
SafeItem.Item = oItem
SafeItem.to = "someone@somewhere.com" 
SafeItem.Subject = "Testing Redemption" 
SafeItem.Body = "Hello World"
[red]SafeItem.Send[/red]

set Utils = CreateObject("Redemption.MAPIUtils")
Utils.Cleanup

The error appears to occur on the line highlighted in [red]red[/red].

Many thanks
Andrew
 
Try this one you only need an smtp server thats all

Set m_objCDO = CreateObject("CDO.Message")
Set m_objCDOcon = CreateObject("CDO.Configuration")

Const cdoSendUsingMethod = "Const cdoSendUsingPort = 2
Const cdoSMTPServer = "Const cdoSMTPServerPort ="Const cdoSMTPConnectionTimeout = "Const cdoSMTPAuthenticate = "Const cdoBasic = 1
Const cdoSendUserName = "Const cdoSendPassword = "
meldung = "Dear Sir, <br> your message"
'Sending email notification

Set Fields = m_objCDOcon.Fields
'Setting up Message parameters
With Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
'Replace with your SMTP server
.Item(cdoSMTPServer) = "TAES-SMXV-01"
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPConnectionTimeout) = 100
'Only used if SMTP server requires Authentication
'.Item(cdoSMTPAuthenticate) = cdoBasic
'.Item(cdoSendUserName) = "yourusername"
'.Item(cdoSendPassword) = "yourpassword"
.Update
End with

'Passing parameters to message object
Set m_objCDO.Configuration = m_objCDOcon

With m_objCDO
'Replace with email you wish the message to be sent to
.To = "somemail@mail.com"
'Replace with email you wish the message to be from
.From = "mail@microsoft.com"

' Attachment using known static physical path
'.AddAttachment "c:\Multiping.xls"
'.AddAttachment Server.MapPath("images/asp101-100x30.gif")
' Attachment added directly from a URL
'.AddAttachment " file.htm"
'Replace with subject
.Subject = "Test subject"
'Replace with information you want to be sent
.HTMLBody = meldung
.Send
End With

cheers
 
Many thanks for your post - however I need to make sure that any mail sent appears in the users Sent Items folder. So I need to login to Outlook to do my stuff.

The good news is that, after a good nights sleep, I solved the problem a few minutes ago. There was nothing wrong with the code - instead, the problem was with MAPI.

It seems that Outlook was not the default mail app on my machine. Correcting this and re-registering MAPI to outlook solved the problem.

Thanks again!
Andrew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top