Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Sub MailPortalLink(strLink As String)
- On Error GoTo ErrorHandler
- Dim oInspector As Lime.inspector
- Dim oAddin As Object
- Dim oNewMail As Object
- Dim strBody As String
- Dim strSubject As String
- Set oInspector = Application.ActiveInspector
- 'Kontaktperson
- If Globals.VerifyInspector("person", oInspector, True) Then
- 'Find Addin
- Set oAddin = Application.FindAddIn("LimeOutlookXP.Addin")
- If oAddin Is Nothing Then
- Call Lime.MessageBox(Localize.GetText("addins", "e_mailaddinnotfound"), VBA.vbOKOnly Or VBA.vbError)
- Exit Sub
- End If
- 'Subject
- strSubject = Localize.GetText("GDPR", "t_mail_portal_link_subj")
- 'Link
- strLink = "<a href = """ & strLink & """>" & strLink & "</a>"
- 'Body
- strBody = strBody & "<html><body>"
- strBody = strBody & Localize.GetText("GDPR", "t_mail_portal_link_body")
- strBody = VBA.Replace(strBody, "{{name}}", oInspector.Record.Value("name"))
- strBody = VBA.Replace(strBody, "{{url}}", strLink)
- strBody = VBA.Replace(strBody, VBA.vbLf, "<br>")
- strBody = strBody & "</body></html>"
- ' Create and open email
- Set oNewMail = VBA.CreateObject("LimeOutlookXP.NewMail")
- oNewMail.Recipients = oInspector.Record.Value("email")
- oNewMail.Subject = strSubject
- oNewMail.HTMLBody = strBody
- oNewMail.Context = oInspector.Record
- oNewMail.Display
- End If
- 'Part
- If Globals.VerifyInspector("company", oInspector, True) Then
- 'Find Addin
- Set oAddin = Application.FindAddIn("LimeOutlookXP.Addin")
- If oAddin Is Nothing Then
- Call Lime.MessageBox(Localize.GetText("addins", "e_mailaddinnotfound"), VBA.vbOKOnly Or VBA.vbError)
- Exit Sub
- End If
- 'Subject
- strSubject = Localize.GetText("GDPR", "t_mail_portal_link_subj")
- 'Link
- strLink = "<a href = """ & strLink & """>" & strLink & "</a>"
- 'Body
- strBody = strBody & "<html><body>"
- strBody = strBody & Localize.GetText("GDPR", "t_mail_portal_link_body")
- strBody = VBA.Replace(strBody, "{{name}}", oInspector.Record.Value("name"))
- strBody = VBA.Replace(strBody, "{{url}}", strLink)
- strBody = VBA.Replace(strBody, VBA.vbLf, "<br>")
- strBody = strBody & "</body></html>"
- ' Create and open email
- Set oNewMail = VBA.CreateObject("LimeOutlookXP.NewMail")
- oNewMail.Recipients = oInspector.Record.Value("email")
- oNewMail.Subject = strSubject
- oNewMail.HTMLBody = strBody
- oNewMail.Context = oInspector.Record
- oNewMail.Display
- End If
- 'Installatör
- If Globals.VerifyInspector("installer", oInspector, True) Then
- 'Find Addin
- Set oAddin = Application.FindAddIn("LimeOutlookXP.Addin")
- If oAddin Is Nothing Then
- Call Lime.MessageBox(Localize.GetText("addins", "e_mailaddinnotfound"), VBA.vbOKOnly Or VBA.vbError)
- Exit Sub
- End If
- 'Subject
- strSubject = Localize.GetText("GDPR", "t_mail_portal_link_subj")
- 'Link
- strLink = "<a href = """ & strLink & """>" & strLink & "</a>"
- 'Body
- strBody = strBody & "<html><body>"
- strBody = strBody & Localize.GetText("GDPR", "t_mail_portal_link_body")
- strBody = VBA.Replace(strBody, "{{name}}", oInspector.Record.Value("name"))
- strBody = VBA.Replace(strBody, "{{url}}", strLink)
- strBody = VBA.Replace(strBody, VBA.vbLf, "<br>")
- strBody = strBody & "</body></html>"
- ' Create and open email
- Set oNewMail = VBA.CreateObject("LimeOutlookXP.NewMail")
- oNewMail.Recipients = oInspector.Record.Value("email")
- oNewMail.Subject = strSubject
- oNewMail.HTMLBody = strBody
- oNewMail.Context = oInspector.Record
- oNewMail.Display
- End If
- 'Fastighetsägare
- If Globals.VerifyInspector("property_owner", oInspector, True) Then
- 'Find Addin
- Set oAddin = Application.FindAddIn("LimeOutlookXP.Addin")
- If oAddin Is Nothing Then
- Call Lime.MessageBox(Localize.GetText("addins", "e_mailaddinnotfound"), VBA.vbOKOnly Or VBA.vbError)
- Exit Sub
- End If
- 'Subject
- strSubject = Localize.GetText("GDPR", "t_mail_portal_link_subj")
- 'Link
- strLink = "<a href = """ & strLink & """>" & strLink & "</a>"
- 'Body
- strBody = strBody & "<html><body>"
- strBody = strBody & Localize.GetText("GDPR", "t_mail_portal_link_body")
- strBody = VBA.Replace(strBody, "{{name}}", oInspector.Record.Value("name"))
- strBody = VBA.Replace(strBody, "{{url}}", strLink)
- strBody = VBA.Replace(strBody, VBA.vbLf, "<br>")
- strBody = strBody & "</body></html>"
- ' Create and open email
- Set oNewMail = VBA.CreateObject("LimeOutlookXP.NewMail")
- oNewMail.Recipients = oInspector.Record.Value("email")
- oNewMail.Subject = strSubject
- oNewMail.HTMLBody = strBody
- oNewMail.Context = oInspector.Record
- oNewMail.Display
- End If
- Exit Sub
- ErrorHandler:
- Call UI.ShowError("GDPR.MailPortalLink")
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement