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!

Simple Email Problem

Status
Not open for further replies.

BarryCrosby

Technical User
May 27, 2003
20
AU
All,
I'm trying to send an email from my little app but am having difficulties.

I do not have the full version of VB 6, only the child version so cannot use winsock.

I have tried using MAPI but cannot set the FROM or SENDER, I know i'm doing something wrong but not sure what. I've also tried using
Set App = CreateObject("Outlook.Application")
But once again cannot set the FROM or SENDER.

I've tried downloading VBSENDMAIL.DLL but cannot get a copy, just get an error page when I try to download it from freevbcode.com.

Any tips or help would be appreciated.

Thanks,
B
 
Im no expert but add your MAPI controls and this code into a command button:
MAPISession1.SignOn
MAPIMessages1.SessionID = MAPISession1.SessionID
MAPIMessages1.Compose
MAPIMessages1.RecipIndex = 0
MAPIMessages1.RecipAddress = "'EMAIL ADDRESS"
MAPIMessages1.AddressResolveUI = True
MAPIMessages1.ResolveName
MAPIMessages1.RecipIndex = 1
MAPIMessages1.MsgSubject = 'YOUR SUBJECT
MAPIMessages1.MsgNoteText =
MAPIMessages1.Send
MAPISession1.SignOff
 
klornpallier,
I've tried using MAPI but there is no way to change the FROM user ( SENDER ).

Any ideas?
 
I got the following code from "VB Step By Step" by Michael Halvorson and it works:

Private Sub Command4_Click()
Dim out As Object
Set out = CreateObject("Outlook.Application")
With out.CreateItem(olMailItem)
'To add addressee
.Recipients.Add "tim.jones@win.com"
'To add cc:
.Recipients.Add("Gary.Cole@win.com").Type = o1CC
'To add Subject:
.Subject = "oCCM MODELING REQUEST"
'To add Attachment:
.Attachments.Add "C:\Documents and Settings\ed.hicks\Desktop\VB oCCM MODELING\rptModelingRequestForm"
.Send
End With
End Sub

Hope this helps.
 
Hiccup,
How do I change the FROM or SENDER from the mailbox it is sent from to a specific mailbox?

Basically I need to be able to set the SENDER property but I cannot find out how to do it using MAPI or createobject.


Thanks,
B
 
BarryCrosby
A quick google will find a download - for example:



________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top