I need to create a toolbar button that can be used to send the selected
mail as attachment and the specific string from header of selected mail
in body.
I've created a sample button by using C3PO wizard and also created a
function that can send a mail to some email address. But facing the
problem:
The mail is sent to the specified address but when checked in groupwise
mail client, then the copy of mail can be seen in trash folder with no
To address and a copy in the 'Sent Mail' folder but delivered status as
pending.
The code used to send the mail is as below:
Code:
--------------------
Sub send_mail()
Try
Dim strFrom, strSubject, strBody
Dim objGW As GroupwareTypeLibrary.Application
strSubject = "Subject Text"
strBody = "Body text." & Chr(10) & Chr(10) & _
Chr(9) & "This text will be separated by returns and a tab."
objGW = DirectCast(CreateObject("NovellGroupWareSession"), GroupwareTypeLibrary.Application)
With objGW
With .Login
With .MailBox.Messages.Add(Class:="GW.MESSAGE.MAIL", Type:=GroupwareTypeLibrary.MessageBoxTypeConstants .egwDraft)
.Subject.PlainText = strSubject
.BodyText.PlainText = strBody
.Sender.EMailAddress = "sender@mailserver.com"
'.Attachments.Add("C:\File_Name.xls")
'.Sender.EMailAddress = "<sender@mailserver.com>" 'line not working
.Recipients.Add("<targetemail@mailserver.com>", , GroupwareTypeLibrary.AddressTargetTypeConstants.eg wTo)
'.Recipients.Resolve()
.Send()
.Refresh()
End With
End With
.Quit()
End With
objGW = Nothing
MsgBox("Email has been sent!", vbInformation, "Email Notification")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
--------------------
Also
-Also please help me how I can get the selected mail from the client
window?
- How I can send the selected mail as attachment?
- How I can get the mail header from the selected mail? presently I'm
using the following code:
Code:
--------------------
Private Sub mailAttachments()
Dim objGW As GroupwareTypeLibrary.Application
Dim objMail As GroupwareTypeLibrary.Mail
objGW = DirectCast(CreateObject("NovellGroupWareSession"), GroupwareTypeLibrary.Application)
With objGW
With .Login
For Each objMail In .AllFolders.ItemByName("MailBox").Messages
With objMail
If .Attachments.Count > 0 Then
For i As Integer = 1 To .Attachments.Count
If Right(.Attachments().Item(i).fileName, 8) = "Mime.822" Then
'Read attachment
.Attachments().Item(i).Save("C:\GWAttachmentTest\" & .Attachments().Item(i).fileName)
Dim arrList As New ArrayList
arrList.AddRange(File.ReadAllLines("C:\GWAttachmentTest\" & objMail.Attachments().Item(i).fileName))
File.Delete("C:\GWAttachmentTest\" & objMail.Attachments().Item(i).fileName)
Dim msg As String = String.Empty
For Each curL As String In arrList
msg = msg & vbCrLf & curL
Next
MsgBox(msg)
End If
Next
End If
End With
Next
End With
End With
End Sub
--------------------
But this code also includes the subject line and also body line. which
slower s the processing.
Please help me, its very urgent. I'm trying from long time to find the
solution but have no clear solution yet. Please help me to sort out the
issues.......
--
testsc0
------------------------------------------------------------------------
testsc0's Profile:
http://forums.novell.com/member.php?userid=28582
View this thread:
http://forums.novell.com/showthread.php?t=352498