I am trying to send email from Lotus Script. But the email doesn't seem to have the FORM ( named Email Form , referred below in the code ) attached to it, when received in the inbox.
When I check the Document property in the email, it says the form is "Memo" and the FROM, TO addresses are Blank.
I have defined the FROM, TO,SUBJECT,BODY fields in the Email Form in a specific format .
But all these field values are populated correctly in the form. Issue happens only after send .
The Same code works fine in some other Lotus Notes, when the email is triggered by another person, having a different Notes ID configured in that system .
Not sure if this is code issue, or Lotus Notes configuration issue .
Any help to solve this would be greatly appreciated . The for has the property " Store Form in Doc" set and even ComputeWithForm returns success .
Could this be a problem with my Lotus notes settings/configuration? .Same code sends email in correct format in some other system configured wit their Notes ID
Here is a sample code on the EMAIL Action button
Sub Click(Source As Button)
Set email = db.CreateDocument
Call email.ReplaceItemValue("Form", "Email Form")
Call email.ReplaceItemValue("Subject", " My TestEmail")
Call email.ReplaceItemValue("From", nom.Canonical)
Call email.ReplaceItemValue("SendTo", nom.Canonical)
Call email.ReplaceItemValue("Body", " Hello, my test email ")
Call email.Send(True,nom.Common)
End Sub
It seems you mixed syntax here, you both set SendTo and specify nom.common, only one should be done. As in the help you should use:
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set doc = New NotesDocument( db )
doc.Form = "Email Form"
doc.SendTo = "Elissa Minty"
doc.Subject = "Here's the document you wanted"
Call doc.Send( true ) 'true here means you the form is stored and sent along with the document.
Now, check that you "Allow use of stored forms in this database." in your DB, could it be that this code exists in differents DBs and one doesn't have "Email Form" ? BTW check is it really "Email Form" and not "Email" ?
You may need also to check the local configuration on the client. To do this refer to Help.
Its not that complicated to send mails usually, with docs from a Mail Enabled database. But now you have added a more complicated solution, than necessary, you may want to review your solution, to save yourself of future problems.
You won't even need to LotusScript this, provided the Mail fields (SendTo as minimum) is there on the document.
See here how:
Designer 8.5.3 Help - Setting up automatic mailing
Related
When a Sales Order is emailed to a customer with Email Preference set to PDF, the body of the email reads:
Please open the attached file to view your Sales Order.
To view the attachment, you first need the free Adobe Acrobat Reader. If you don't have it yet, visit Adobe's Web site http://www.adobe.com/products/acrobat/readstep.html to download it.[/CODE]
I'd like to add onto this message a bit. I think that will require me to write a script that renders the transaction to a PDF template and sends the email with whatever message I choose. It also needs to prevent NetSuite from sending the default email as well.
Would the following work:
In a beforeSubmit function on Sales Order records, if the customer has Email Preference=PDF, uncheck the 'Email To' field. Set a new custom checkbox such as 'Email PDF' to true instead.
In a User Event Script, after a Sales Order submits and has 'Email PDF' set to true, render the transaction to a PDF and send it in an email to all the 'Email To' recipients.
Or is there a better solution I may be overlooking?
The 'duplicate question' says this can't be done yet I have a working solution. It also references SuiteTalk, not the same.
This is a solution someone gave me on the official NetSuite forum:
You can accomplish this fairly easily with a Workflow.
- Trigger on Before Record Submit when 'To Be E-mailed' = T
- Set Field Value of 'To Be E-mailed' = F
- Transition to next state After Record Submit
- Use 'Send Email' action. This allows you to use an email template and
also automatically attach pdf
I would like to also change the field "sent by" (displaying when there is a mailDoc.Principal) in the mail being sent by a triggered agent created in lotus script. Is it possible to change it I already tried the following codes
mailDoc.SentBy = strFrom
mailDoc.tmpDisplaySentBy = strFrom
mailDoc.FROM = strFrom
mailDoc.SendFrom = strFrom
Still I couldn't change that part.. Is it possible or is there some limitation?.. Thanks
You can't change it. The server puts always the current username into field Principal/From.
But there is a workaround: instead of sending the mail save the mail document into mail.box on server with a Principal/From field content of your choice. This way server won't change the field anymore.
Here is an example from Karl-Henry Martinsson how to do it.
I have created a CPP COM dll to read a EML File and add it to Lotus notes NSF file. Using MIMEContent to create the mails but the problem is when i am adding the document to folder view $Inbox same mail is copied $Sent Item Folder. Below is the code
newdoc.Save();
Folder.FolderAddDocument(newdoc);
// Color the background
Folder.SetBackgroundColor(LNCOLOR_LIGHT_GRAY);
// Change the heading display
Folder.SetHeadingDisplay(LNVFHEADINGDISPLAY_BEVELED);
Folder.Save();
//cout<<"ReadViews4"<<endl;
Folder.Close();
//cout<<"ReadViews5"<<endl;
newdoc.Close();
Thanks and Regards,
Haseena
This is the selection formula for the Sent view of the 8.5.x mail template:
SELECT DeliveredDate = "" & PostedDate != "" & !(#IsMember("S";
ExcludeFromView))
If the imported mail document should appear as a incoming mail, it must have a DeliveredDate field with a date (which then means that it will not appear in the Sent view).
I can not see how you set the properties of the mail document, since your code example only contains newdoc.Save() and newdoc.Close().
So have a look at the properties of your imported mail, and have a look at the CPP code that sets the properties of the mail document.
Like others said:
Create the field "DilveredDate". Replace its value with e.g. Today.
DateTime timenow = session.createDateTime("Today");
timenow.setNow();
newdoc.replaceItemValue("DeliveredDate", timeNow);
And your document will not show up in the sendTo-View.
I need some help since I do not know where to start. Ideally, I would like to have a button that can convert my Lotus Notes document to a PDF file, then it will open up a new email then take the email address in that document to the "To" filed. At this point we use CutePDF writer to create the PDF file. I break down the process like the one below:
Print a document
User choose CutePDFwriter
Save the pdf file
Compose a new email with the email address that is on the Notes document placed on the 'To' field
Can anyone help me starting on this?
If you're happy to let the user select cutepdf as the printer, you should be able to get away with using #Commands in a button from the either the document or a view containing the documents (Check the notes designer help).
The only issue I can see is that the user will be able to change the path that cutepdf prints to, so you will have to make the user find the attachment again (but you will be able to automate the attachment dialog coming up).
Got my answer from Domino Designer help file. Use the code below to open up mail file
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
Dim doc As NotesDocument
Dim item As NotesItem
Set doc = uidoc.Document
Set item = doc.GetFirstItem("QSContactEMail")
Set uidoc = workspace.ComposeDocument _
(mailserver$, mailfile$, "Memo")
Call uidoc.FieldAppendText("EnterSendTo", "Test")
For the printing I just call the print function and let the user choose CutePDF writer
Is it possible to automate lotus notes to post a local file to a database? I have a daily task to post a logfile to a notes database. I can gather the logfile via script but don't know enough about notes scripting to figure this out.
I know thrre is a com interface as long as I have the client on the PC, but I can't figure out how to get a file uploaded to a dataase. I can use either vbscript or (preferred) powershell
If you search around the net you'll find examples of using VBScript to manipulate Lotus Notes. Here's one example: http://haveworld.blogspot.com/2006/10/vbscript-and-lotus-notes.html
You'll need to know a little about Lotus Notes to make this work, though. Start small and see if you can even get the Notes Version to appear:
Set oNotesSession = CreateObject("Notes.Notessession") 'create notes session
Msgbox oNotesSession.NotesVersion
If that works, you know you're in good shape. If not, make sure you've installed Lotus Notes correctly and configured it on the client.
The code to post a local file to a database involves connecting to Notes, creating a new Notes Document, adding a file object into the body of the document, and then saving it. You can use any kind of Notes Database to do this, but I'd suggest creating a new one based on the Document Library template, and using that to store your files.
Here is some code that will create a new Notes document, set the subject field, attach a file, and then save the document. This assumes there's a local Notes database already available called "FileStorage.nsf"
strFileName = "C:\Windows\Media\tada.wav"
strSubject = "Your Subject Goes Here"
Set oNotesSession = CreateObject("Notes.Notessession") 'create notes session
Set oDb = oNotesSession.GetDatabase("", "FileStorage.nsf") 'open database on local named FileStorage.nsf
Set oDoc = oDb.CreateDocument
' Filling the fields
oDoc.Subject = strSubject
Set oBody = oDoc.CreateRichTextItem("Body")
oBody.EmbedObject 1454, "", strFileName '1454 = Embedded Attachment type
oDoc.Save False, False