RTKVSNL
asked on
sending mails using outlook object
i am developing an application to send mails using the outlook object. since i was getting a security alert everytime the mails were sent, i downloaded and used the Redemption.dll library and safe mail objects.
i have pasted the code below:
Set myItem = CreateObject("Redemption.S afeMailIte m")
Set oitem = oOutlookApplication.Create Item(olMai lItem)
strToAddress = olInboxItems_ItemAdd(myITe ms(intcnt) )
myItem.Item = oitem
myItem.Recipients.Add (strToAddress)
myItem.Recipients.ResolveA ll
myItem.Subject = "test"
myItem.Body = "this is a test"
the problem with this code is that the mails are sent to the draft folder and not the outbox. i found out why this is happening. it is because there is no email address in "sent by". i am not able to assign a sent by email address using redemption. so what is the solution to this?
i have pasted the code below:
Set myItem = CreateObject("Redemption.S
Set oitem = oOutlookApplication.Create
strToAddress = olInboxItems_ItemAdd(myITe
myItem.Item = oitem
myItem.Recipients.Add (strToAddress)
myItem.Recipients.ResolveA
myItem.Subject = "test"
myItem.Body = "this is a test"
the problem with this code is that the mails are sent to the draft folder and not the outbox. i found out why this is happening. it is because there is no email address in "sent by". i am not able to assign a sent by email address using redemption. so what is the solution to this?
ASKER
this cannot solve my problem because outlook has a security patch that needs a response from the user every time a mail will be sent. that is why i am using the redemption object.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Private Sub Command4_Click()
Dim iOutlook As Outlook.Application
Dim myApp As Outlook.MailItem
Set iOutlook = New Outlook.Application
Set myApp = iOutlook.CreateItem(olMail
temp = "username"
txtMessage = "Hello World Again!"
AttachFile = "C:\test\test.gif"
myApp.To = "receiver@domain.com"
myApp.Subject = "Hello World!"
myApp.Attachments.Add AttachFile
myApp.Body = "Hi " & temp & vbCrLf & vbCrLf & txtMessage
myApp.Send
Do While iOutlook.GetNamespace("MAP
DoEvents
Loop
MsgBox "Successfully Sent", vbInformation, "Email Sent"
End Sub