I am building an application that contains data that needs to be fed out to seperate groups of people.
Sending them emails is the only way to do it but this takes ages to do.
Does anyone know of a way to send emails through lotus notes via vb.net code.
i need for example to send:
send to = textbox1.text subject = textbox2.text body = textbox3.text
i hope someone can help
Hope this helps
Edited by lolafuertes: n/a
Have looked at that code and it wants to create a new session of notes - i need it to link to an already open session of notes. Do you know of a way to do this -
Use the GetObject instead of CreateObject.
If a sessions exists, this will attach to the session, else will create a new session.
Hope this helps.
I am trying to use the getobject rather than createobject but in both circumstances it gives me an error - activex cannot create object.
I have added the references to link to the notes domino server and put in the lotus reference but still nothing any ideas???
thanks for all your help by the way i feel that i am learning something new all the time.
Nope. I currently have no Lotus Note installed to test. Sorry.
Maybe, if you put your code and te reference of dlls used in the project, we (the community) can help you to search for a solution.
we are using the following at the moment - which always says activex cannot create object when it gets to the line that says 'Set noSession = CreateObject("Notes.NotesSession")'
[vba]Sub SendWithLotus() Dim noSession As Object, noDatabase As Object, noDocument As Object Dim obAttachment As Object, EmbedObject As Object Dim stSubject As Variant, stAttachment As String Dim vaRecipient As Variant, vaMsg As Variant Const EMBED_ATTACHMENT As Long = 1454 Const stTitle As String = "Active workbook status" Const stMsg As String = "The active workbook must first be saved " & vbCrLf _ & "before it can be sent as an attachment." 'Check if the active workbook is saved or not 'If the active workbook has not been saved at all. If Len(ActiveWorkbook.Path) = 0 Then MsgBox stMsg, vbInformation, stTitle Exit Sub End If 'If the changes in the active workbook have been saved or not. If ActiveWorkbook.Saved = False Then If MsgBox("Do you want to save the changes before sending?", _ vbYesNo + vbInformation, stTitle) = vbYes Then _ ActiveWorkbook.Save End If 'Get the name of the recipient from the user. Do vaRecipient = Application.InputBox( _ Prompt:="Please add name of the recipient such as:" & vbCrLf _ & "email@example.com or just the name if internal mail within Unity.", _ Title:="Recipient", Type:=2) Loop While vaRecipient = "" 'If the user has canceled the operation. If vaRecipient = False Then Exit Sub 'Get the message from the user. Do vaMsg = Application.InputBox( _ Prompt:="Please enter the message such as:" & vbCrLf _ & "Enclosed please find the weekly report.", _ Title:="Message", Type:=2) Loop While vaMsg = "" 'If the user has canceled the operation. If vaMsg = False Then Exit Sub 'Add the subject to the outgoing e-mail 'which also can be retrieved from the users 'in a similar way as above. Do stSubject = Application.InputBox( _ Prompt:="Please add a subject such as:" & vbCrLf _ & "Weekly Report.", _ Title:="Subject", Type:=2) Loop While stSubject = "" 'Retrieve the path and filename of the active workbook. stAttachment = ActiveWorkbook.FullName 'Instantiate the Lotus Notes COM's Objects. Set noSession = CreateObject("Notes.NotesSession") Set noDatabase = noSession.GETDATABASE("", "") 'If Lotus Notes is not open then open the mail-part of it. If noDatabase.IsOpen = False Then noDatabase.OPENMAIL 'Create the e-mail and the attachment. Set noDocument = noDatabase.CreateDocument Set obAttachment = noDocument.CreateRichTextItem("stAttachment") Set EmbedObject = obAttachment.EmbedObject(EMBED_ATTACHMENT, "", stAttachment) 'Add values to the created e-mail main properties. With noDocument .Form = "Memo" .SendTo = vaRecipient .Subject = stSubject .Body = vaMsg .SaveMessageOnSend = True End With 'Send the e-mail. With noDocument .PostedDate = Now() .Send 0, vaRecipient End With 'Release objects from the memory. Set EmbedObject = Nothing Set obAttachment = Nothing Set noDocument = Nothing Set noDatabase = Nothing Set noSession = Nothing 'Activate Excel for the user. AppActivate "Microsoft Excel" MsgBox "The e-mail has successfully been created and distributed.", vbInformation End Sub [/vba]
please can someone help with this as it is a major nut job for me at the moment.
I the link I send you, to create the session calls to Lotus.NotesSession, not Notes.NotesSession.
Please, verify in your registry the one defined.
Hope this helps
I tried several versions of code to get it to work - calling notes.notessession and lotus.notessession as well as .notesuiworkplace - the bit stopping any off them frmo working was that there was no registry - removed from all work pc's.
Now i have put it back i have got my excel vba version of the code to work perfectly - i will be finishing the vb.net version today with any luck.
Thanks for the guidance.
I've got that piece of code to work
but i need to send it from a group account rather than my main account - any ideas....
I've tried telling it to look for the below
MailDbName = "mail\group\teamaccount.nsf" ''''MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf" Set Maildb = Session.GETDATABASE("", MailDbName)
but it only ever sends from my main account.....
hope you can help with this as our group IT specialists haven't got a clue - they said that my account file was names.nsf which was a load of tripe.
In order to send using a group name, you must 'login' to Notes with the group name.
How to do that? Depends on how your LAN administrator and the Notes adminitrator (maybe is a unique person) have defined user authentication on both systems, if the authentication is integrated in an Active Directory or not, if the group is just an email distribution group, or can be used as an account, etc. Maybe you'll need to start a distinct thread for that.
My 'cheap' advice is to send the mails with your account, specifying some where the text: 'on behalf of the teamaccount'.
Hope this helps. I think your very first post on this thread is solved. Isn't? If yes, please be so kind to mark this thread as solved. Cheers.
I have an assignment to output contents from a .txt file to html. I'm able to output the information from the .txt to the console but how would I output ...
hi all , i search for motion detector documents and code source with systemC programming language, any help pls
Hello, am working on a program for the U.S. Department of Labor. I am working on two programs for the state of Oregon, and the program that reads data and ...