Public Sub sendMail(ByRef myrng As Range, ByRef modulename As String)
On Error Resume Next
Set olNS = Application.GetNamespace("MAPI")
Set outlukApp = New Outlook.Application
Set outlukMailitem = outlukApp.CreateItem(olMailItem)
If modulename = "Newjoineemail" Then
With outlukMailitem
.SendUsingAccount = olNS.Accounts.Item(2)
.Display
.To = "neeti.seth@koenig-solutions.com"
.BCC = "sakshi.dhawan@koenig-solutions.com;ruchika.dhir@koenig-solutions.com; pooja.sharma@koenig-solutions.com; praveen@koenig-solutions.com; sonia.sharma@koenig-solutions.com; shekhar@koenig-solutions.com; rajesh.khandelwal@koenig-solutions.com; meghana.anand@koenig-solutions.com; anuradha.pant@koenig-solutions.com; Gayatri.chauhan@koenig-solutions.com; Arpit.gupta@koenig-solutions.com; puja.prasad@koenig-solutions.com; ea@koenig-solutions.com; mansi.malik@koenig-solutions.com; silky.bhateja@koenig-solutions.com; shruti.kapoor@koenig-solutions.com; amit@koenig-solutions.com; teamrecruitment@koenig-solutions.com; generalist@koenig-solutions.com; kt@koenig-solutions.com; raman.thakur@koenig-solutions.com; geeta.gakhar@koenig-solutions.com; jaishree.pal@koenig-solutions.com; amit.garg@koenig-solutions.com ; pooja.gautam@koenig-solutions.com"
.Subject = "New Joinee Details"
.HTMLBody = "<p>Dear All,<br><br>The below mentioned have joined Koenig as:</p><br><br>" & RangetoHTML(myrng) & "<br>" & .HTMLBody
End With
ElseIf modulename = "lastworkingDay" Then
With outlukMailitem
.Display
.To = "managers@koenig-solutions.com"
.Subject = "Left Employee"
.HTMLBody = "<p>Dear Managers,<br><br>Please note that the last working day of following employee:</p><br><br>" & RangetoHTML(myrng) & "<br>" & .HTMLBody
End With
ElseIf modulename = "Newjoineemail2" Then
With outlukMailitem
.Display
.To = "neeti.seth@koenig-solutions.com"
.Subject = "New Joinee"
.BCC = "managers@koenig-solutions.com;ruchika.dhir@koenig-solutions.com;neha.maggon@koenig-solutions.com; meghana.anand@koenig-solutions.com; Gayatri.chauhan@koenig-solutions.com; neetu.a@koenig-solutions.com; sonia.sharma@koenig-solutions.com; ranjan.manish@koenig-solutions.com; shruti.kapoor@koenig-solutions.com; anuradha.pant@koenig-solutions.com; teamrecruitment@koenig-solutions.com; generalist@koenig-solutions.com; resource@koenig-solutions.com; geeta.gakhar@koenig-solutions.com; raman.thakur@koenig-solutions.com; jaishree.pal@koenig-solutions.com; pooja.gautam@koenig-solutions.com"
.HTMLBody = "<p>Dear All,<br><br>The below mentioned have joined Koenig as:</p><br><br>" & RangetoHTML(myrng) & "<br>" & .HTMLBody
End With
End If
End Sub
On Error Resume Next
Set olNS = Application.GetNamespace("MAPI")
Set outlukApp = New Outlook.Application
Set outlukMailitem = outlukApp.CreateItem(olMailItem)
If modulename = "Newjoineemail" Then
With outlukMailitem
.SendUsingAccount = olNS.Accounts.Item(2)
.Display
.To = "neeti.seth@koenig-solutions.com"
.BCC = "sakshi.dhawan@koenig-solutions.com;ruchika.dhir@koenig-solutions.com; pooja.sharma@koenig-solutions.com; praveen@koenig-solutions.com; sonia.sharma@koenig-solutions.com; shekhar@koenig-solutions.com; rajesh.khandelwal@koenig-solutions.com; meghana.anand@koenig-solutions.com; anuradha.pant@koenig-solutions.com; Gayatri.chauhan@koenig-solutions.com; Arpit.gupta@koenig-solutions.com; puja.prasad@koenig-solutions.com; ea@koenig-solutions.com; mansi.malik@koenig-solutions.com; silky.bhateja@koenig-solutions.com; shruti.kapoor@koenig-solutions.com; amit@koenig-solutions.com; teamrecruitment@koenig-solutions.com; generalist@koenig-solutions.com; kt@koenig-solutions.com; raman.thakur@koenig-solutions.com; geeta.gakhar@koenig-solutions.com; jaishree.pal@koenig-solutions.com; amit.garg@koenig-solutions.com ; pooja.gautam@koenig-solutions.com"
.Subject = "New Joinee Details"
.HTMLBody = "<p>Dear All,<br><br>The below mentioned have joined Koenig as:</p><br><br>" & RangetoHTML(myrng) & "<br>" & .HTMLBody
End With
ElseIf modulename = "lastworkingDay" Then
With outlukMailitem
.Display
.To = "managers@koenig-solutions.com"
.Subject = "Left Employee"
.HTMLBody = "<p>Dear Managers,<br><br>Please note that the last working day of following employee:</p><br><br>" & RangetoHTML(myrng) & "<br>" & .HTMLBody
End With
ElseIf modulename = "Newjoineemail2" Then
With outlukMailitem
.Display
.To = "neeti.seth@koenig-solutions.com"
.Subject = "New Joinee"
.BCC = "managers@koenig-solutions.com;ruchika.dhir@koenig-solutions.com;neha.maggon@koenig-solutions.com; meghana.anand@koenig-solutions.com; Gayatri.chauhan@koenig-solutions.com; neetu.a@koenig-solutions.com; sonia.sharma@koenig-solutions.com; ranjan.manish@koenig-solutions.com; shruti.kapoor@koenig-solutions.com; anuradha.pant@koenig-solutions.com; teamrecruitment@koenig-solutions.com; generalist@koenig-solutions.com; resource@koenig-solutions.com; geeta.gakhar@koenig-solutions.com; raman.thakur@koenig-solutions.com; jaishree.pal@koenig-solutions.com; pooja.gautam@koenig-solutions.com"
.HTMLBody = "<p>Dear All,<br><br>The below mentioned have joined Koenig as:</p><br><br>" & RangetoHTML(myrng) & "<br>" & .HTMLBody
End With
End If
End Sub
No comments:
Post a Comment