Prashantbhatnagar
asked on
Mail to selected names from a field...
I have a field called "Names". This is a dialog list with multi values enabled.Now I want a button or a action which can send a mail with desired subject and body to the selected user from the Name field.
Pls help.
Pls help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
A sample code in Lotus Script:
Sub SendMailToRequestFromAdmin 1
Print "Submitting mail to approving person ..."
Dim ws As New notesuiworkspace
Dim uidoc As notesuidocument
Dim doc As notesdocument
Dim item As NotesItem
Dim numvalues As Integer
Dim session As New notessession
Dim db As notesdatabase
Dim maildoc As notesdocument
Dim Body As NotesRichTextItem
Dim hard As String
Set db=session.currentdatabase
Set uidoc=ws.currentdocument
Set doc=uidoc.document
tmpamount=Cstr(doc.grandto tal_n(0))
'SEND MAIL TO DEPT HEAD.
Dim item1 As notesitem
Set item1 =doc.getfirstitem("staffna me_x")
' For y = 0 To Ubound(item1.values)
Set maildoc = New NotesDocument( db )
maildoc.Form = "Memo"
If (uidoc.Fieldgettext("statu s_x")="App roved") Then
maildoc.Subject ="Payment Voucher - Approved"
Set Body=New NotesRichTextItem(maildoc, "Body")
message="Your Payment Voucher for the items requested for the amount "+tmpamount+" has been approved. Thank you."
End If
If doc.status_x(0)="Pending" Then
maildoc.Subject ="New Payment Voucher"
Set Body=New NotesRichTextItem(maildoc, "Body")
message="Please check the items requested to this month to your department for the amount "+tmpamount+". Thank you."
End If
If (uidoc.Fieldgettext("statu s_x")="Rej ected") Then
maildoc.Subject ="Payment Voucher - Rejected"
Set Body=New NotesRichTextItem(maildoc, "Body")
message="Your Payment Voucher for the items requested for the amount "+tmpamount+" has been rejected. Please make necessary amendmends and re-submit again. Thank you."
End If
Call Body.AppendText(message)
Call Body.AddNewLine(2)
message1="Click here to open the form=========>>"
Call Body.AppendText(message1)
Call Body.AppendDocLink(doc,"Pl ease click this link to open the document")
Call Body.AddNewLine(2)
mess="(This is an auto-generated email. You may delete this after review.)"
Call Body.AppendText(mess)
For y = 0 To Ubound(item1.values)
hard=item1.values(y)+"@sto neforest.c om.sg"
Print "Submitted to : "+item1.values(y)
Call maildoc.Send( True, hard)
Next
End Sub
Sub SendMailToRequestFromAdmin
Print "Submitting mail to approving person ..."
Dim ws As New notesuiworkspace
Dim uidoc As notesuidocument
Dim doc As notesdocument
Dim item As NotesItem
Dim numvalues As Integer
Dim session As New notessession
Dim db As notesdatabase
Dim maildoc As notesdocument
Dim Body As NotesRichTextItem
Dim hard As String
Set db=session.currentdatabase
Set uidoc=ws.currentdocument
Set doc=uidoc.document
tmpamount=Cstr(doc.grandto
'SEND MAIL TO DEPT HEAD.
Dim item1 As notesitem
Set item1 =doc.getfirstitem("staffna
' For y = 0 To Ubound(item1.values)
Set maildoc = New NotesDocument( db )
maildoc.Form = "Memo"
If (uidoc.Fieldgettext("statu
maildoc.Subject ="Payment Voucher - Approved"
Set Body=New NotesRichTextItem(maildoc,
message="Your Payment Voucher for the items requested for the amount "+tmpamount+" has been approved. Thank you."
End If
If doc.status_x(0)="Pending" Then
maildoc.Subject ="New Payment Voucher"
Set Body=New NotesRichTextItem(maildoc,
message="Please check the items requested to this month to your department for the amount "+tmpamount+". Thank you."
End If
If (uidoc.Fieldgettext("statu
maildoc.Subject ="Payment Voucher - Rejected"
Set Body=New NotesRichTextItem(maildoc,
message="Your Payment Voucher for the items requested for the amount "+tmpamount+" has been rejected. Please make necessary amendmends and re-submit again. Thank you."
End If
Call Body.AppendText(message)
Call Body.AddNewLine(2)
message1="Click here to open the form=========>>"
Call Body.AppendText(message1)
Call Body.AppendDocLink(doc,"Pl
Call Body.AddNewLine(2)
mess="(This is an auto-generated email. You may delete this after review.)"
Call Body.AppendText(mess)
For y = 0 To Ubound(item1.values)
hard=item1.values(y)+"@sto
Print "Submitted to : "+item1.values(y)
Call maildoc.Send( True, hard)
Next
End Sub
ASKER
Hi Hemanth,
Thanks a lot ...I never thought answer could be so simple..
Regards
Thanks a lot ...I never thought answer could be so simple..
Regards
That is why we are all here.. Keep It Simple !!
Subject := "Subject goes here";
Message := "Body goes here";
@MailSend(Names; ""; "" ;Subject; Message; "");