Problem with Dot(.) in email Address
Hi,
i send with VB Code (Word VBA 2007) an GW 7.0.3 Build 1294 a Mail to a Mail Address eg abc.defg@abc.de
The Postmaster of abc.de recives abc@abc.de
any a idea what here is wrong...
tnx for help
Here is the complete code
'/// Send mail with GW //
Sub Send_GW_Mail(ByVal SinSendOpt As Single, _
ByVal StrMail_To As String, _
ByVal StrMail_Cc As String, _
ByVal StrMail_Bcc As String, _
ByVal StrMail_Betreff As String, _
ByVal SinAZ As Single, _
ByVal StrAnlagen As String, _
ByVal StrMail_Text As String, _
ByVal StrFuss_text As String)
Dim GW As Variant
Dim Acc As Variant
Dim GWMailFolder As Variant
Dim GWMessages As Variant
Dim GWMessage As Variant
Dim GWDraftMsg As Variant
Dim GWRecips As Variant
Dim GWRecip As Variant
Dim sRecieverTo, sRecieverCC, sRecieverBcc As String
Dim SenderDisplayName As String
Dim SenderEmailAddress As String
Dim CreationDate As Date
Dim iCount As Integer
Dim vCommander As Variant
Dim ParamStr As String
Dim MyMsgID As String
Dim sResult As String
Dim iRet As Integer
Dim sDOT, RecDot
Dim iPos, RecPos
Dim SenderEmailAddressType
Dim sAttachment
Dim egwIncoming, egwMessagePrivate, egwNormal, egwDefaultSecurity
Dim ToDot, CcDot, BcDot
Dim iElement As Long
Dim GWAddrBook As Object
Dim GWAccount As Object
Dim GWEntry As Object
Dim GWEntries As Object
Set GW = CreateObject("NovellGroupWareSession")
Set GWAccount = GW.Login()
Set GWAddrBook = GWAccount.AddressBooks("Primärbuch")
Set Acc = GW.Login
Set GWMailFolder = Acc.Mailbox
Set GWMessages = GWMailFolder.Messages
Set GWDraftMsg = GWMessages.Add("GW.MESSAGE.MAIL", "Draft")
sRecieverTo = StrMail_To
sRecieverCC = StrMail_Cc
sRecieverBcc = StrMail_Bcc
' Mail Betreff definieren
If StrMail_Betreff > "" Then GWDraftMsg.Subject = StrMail_Betreff
' Mail text (Body) definieren
GWDraftMsg.BodyText = StrMail_Text & Chr$(13) & vbCrLf & Chr$(13) & vbCrLf & Chr$(13) & vbCrLf & StrFuss_text
' Sender Name
GWDraftMsg.FromText = Acc.RootFolder.Name
' Anlagen Anfügen ################################################## ###
For II = 1 To SinAZ
If StrAnlagen(II) = "" Then
'nix
Else
GWDraftMsg.Attachments.Add StrAnlagen(II)
End If
Next II
' E-Mail Adresse zuweisen ################################################## ######
Set GWRecips = GWDraftMsg.Recipients
'Wenn ein Komma kommt
sRecieverTo = Replace(sRecieverTo, ",", ";", 1)
sRecieverCC = Replace(sRecieverCC, ",", ";", 1)
sRecieverBcc = Replace(sRecieverBcc, ",", ";", 1)
'Email Empfänger Aufsplitten
ToDot = Split(sRecieverTo, ";")
CcDot = Split(sRecieverCC, ";")
BcDot = Split(sRecieverBcc, ";")
' MailTo Zuweisen
Dim StrDisplayName, StrMailAdress
For iElement = 0 To UBound(ToDot)
If ToDot(iElement) = "" Then
Exit For
Else
StrMailAdress = CStr(Trim((ToDot(iElement))))
StrDisplayName = Split(CStr(Trim((ToDot(iElement)))), "@", , vbTextCompare)
StrDisplayName(0) = Replace(StrDisplayName(0), ".", " ", 1, , vbTextCompare)
Set GWEntries = GWAddrBook.AddressBookEntries.Find("(<Email-Adresse> Matches " & """" & StrMailAdress & """" & ")")
If GWEntries.Count > 0 Then
Set GWEntry = GWEntries.Item(1)
Else
Set GWEntry = GWAddrBook.AddressBookEntries.Add(StrDisplayName(0 ), StrMailAdress, "NGW", "")
End If
Set GWRecip = GWRecips.Add(GWEntry.EMailAddress, "NGW", 0) '1 = CC and 2 = BC
GWRecip.DisplayName = GWEntry.DisplayName
GWDraftMsg.Recipients.Resolve
'GWRecip.EmailType = "NGW"
End If
Next iElement
Erase StrDisplayName
StrMailAdress = ""
For iElement = 0 To UBound(CcDot)
If CcDot(iElement) = "" Then
Exit For
Else
StrMailAdress = CStr(Trim((CcDot(iElement))))
StrDisplayName = Split(CStr(Trim((CcDot(iElement)))), "@", , vbTextCompare)
StrDisplayName(0) = Replace(StrDisplayName(0), ".", " ", 1, , vbTextCompare)
Set GWEntries = GWAddrBook.AddressBookEntries.Find("(<Email-Adresse> Matches " & """" & StrMailAdress & """" & ")")
If GWEntries.Count > 0 Then
Set GWEntry = GWEntries.Item(1)
Else
Set GWEntry = GWAddrBook.AddressBookEntries.Add(StrDisplayName(0 ), StrMailAdress, "NGW", "")
End If
Set GWRecip = GWRecips.Add(GWEntry.EMailAddress, "NGW", 1) '1 = CC and 2 = BC
GWRecip.DisplayName = GWEntry.DisplayName
GWDraftMsg.Recipients.Resolve
End If
Next iElement
Erase StrDisplayName
StrMailAdress = ""
For iElement = 0 To UBound(BcDot)
If BcDot(iElement) = "" Then
Exit For
Else
StrMailAdress = CStr(Trim((BcDot(iElement))))
StrDisplayName = Split(CStr(Trim((BcDot(iElement)))), "@", , vbTextCompare)
StrDisplayName(0) = Replace(StrDisplayName(0), ".", " ", 1, , vbTextCompare)
Set GWEntries = GWAddrBook.AddressBookEntries.Find("(<Email-Adresse> Matches " & """" & StrMailAdress & """" & ")")
If GWEntries.Count > 0 Then
Set GWEntry = GWEntries.Item(1)
Else
Set GWEntry = GWAddrBook.AddressBookEntries.Add(StrDisplayName(0 ), StrMailAdress, "NGW", "")
End If
Set GWRecip = GWRecips.Add(GWEntry.EMailAddress, "NGW", 2) '1 = CC and 2 = BC
GWRecip.DisplayName = GWEntry.DisplayName
GWDraftMsg.Recipients.Resolve
End If
Next iElement
Erase StrDisplayName
StrMailAdress = ""
SenderDisplayName = ""
SenderEmailAddress = ""
SenderEmailAddressType = "NGW"
CreationDate = Now
Set GWMessage = GWMessages.AddExistingMessage(SenderDisplayName, SenderEmailAddress, SenderEmailAddressType, _
CreationDate, egwIncoming, egwMessagePrivate, egwNormal, egwDefaultSecurity, GWDraftMsg)
GWMailFolder.Refresh
Set GWMessages = Nothing
Set GWMessages = GWMailFolder.Messages
' Send or Show - 1 = sho Msg / 2 = send direct
'///////////////////////////////////////////////////////
If SinSendOpt = 1 Then
' Open the new message to view it and add recipient(s) manually
MyMsgID = GWMessage.MessageID
Set vCommander = CreateObject("GroupWiseCommander")
ParamStr = "ItemOpen(""" + MyMsgID + """)"
iRet = vCommander.Execute(ParamStr, sResult)
GWMessage.Delete
Exit Sub
ElseIf SinSendOpt = 2 Then
' Direkt senden
GWMessage.Send
GWMessage.Delete
MsgBox "Ihre Mail wurde gesendet!", vbInformation, "Mail sent"
Else
' Open the new message to view it and add recipient(s) manually
MyMsgID = GWMessage.MessageID
Set vCommander = CreateObject("GroupWiseCommander")
ParamStr = "ItemOpen(""" + MyMsgID + """)"
iRet = vCommander.Execute(ParamStr, sResult)
GWMessage.Delete
Exit Sub
End If
'resetVariables
call ResetVariables
'VariablenZurücksetzten
|