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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CDO Message: How to alias the Sender? 1

Status
Not open for further replies.

checkOut

Technical User
Joined
Oct 17, 2002
Messages
153
Location
NL
I use the function below for sending mail from a server:
It works perfect (i have it from this tektips Site ;)
but in the line: cMessage.From = FromAddr
I want the reciever see My Alias: G.A. Dekker instead of
ga.dekker@werkenbijhetrijk.nl,
how can I put that in my code?
Thanx in advance

Gerard

'Reference ADO 2.5 lib
'Reference CDO for Windows 2000 lib

Public Function fctnOutlook(Optional FromAddr, Optional Addr, Optional cc, Optional BCC, _
Optional Subject, Optional MessageText, Optional AttachmentPath, Optional Vote As String = vbNullString, _
Optional Urgency As Byte = 1, Optional EditMessage As Boolean = True)
On Error GoTo errHandler
Dim cConfiguration As New CDO.Configuration
Dim cFields As ADODB.Fields
Dim cMessage As New CDO.Message

Set cFields = cConfiguration.Fields
With cFields
.Item(cdoSMTPServer) = PARAMPath("Path_Exchange")
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Update
End With
Set cMessage.Configuration = cConfiguration
If IsMissing(FromAddr) Then
FromAddr = EmailCRM
End If
cMessage.From = FromAddr
cMessage.To = Addr
If Not IsMissing(cc) Then
cMessage.cc = cc
End If
If Not IsMissing(BCC) Then
cMessage.BCC = BCC
End If
If Not IsMissing(Subject) Then
cMessage.Subject = Subject
End If
If Not IsMissing(MessageText) Then
cMessage.TextBody = MessageText
End If
If Not IsMissing(AttachmentPath) Then
cMessage.AddAttachment AttachmentPath
End If
cMessage.Send
exitHere:
Exit Function
errHandler:
MsgBox Err.Description & ": " & Err.Number, , "Fout in emailverzenden: Niet verzonden!"
Response = acDataErrContinue
Resume exitHere
End Function
 
Can't you just assign the value to .From? I thought you could.
 
You mean I can Put "G.A. Dekker" in the FromAdress to get this in the From from the reciever?

I'll tried that, but it failed.
I think something like
.From = "Ga.Dekker@werkenbijhetrijk.nl as [G.A. Dekker]"
must solve the bug, but this also doesn't the job.

Any other idea?
Thanx in advance,
Gerard
 
Try
G.A. Dekker <Ga.Dekker@werkenbijhetrijk.nl>

Ben

----------------------------------------------
Ben O'Hara

&quot;Where are all the stupid people from...
...And how'd they get so dumb?&quot;
NoFX-The Decline
----------------------------------------------
 
try:
cMessage.SentOnBehalfOfName = &quot;G.A. Dekker&quot;

 
Oharab, ur solution works perfect!
VBAJock thanx for reaction, haven't tried ur solution while Oharab's solves my question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top