Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.4 KiB

  1. # sendhtml.pl
  2. # Perl script to send HTML email messages
  3. # Copyright 1998-99 Microsoft
  4. #
  5. # Modification History:
  6. # 08 JAN 99 GaryKac extracted into separate routine
  7. # xx NOV 98 GaryKac began
  8. #------------------------------------------------------------------------------
  9. # SendHtmlMail
  10. #
  11. # send an HTML message with the given subject and body to the list of
  12. # recipients
  13. #
  14. # Parameters:
  15. # $szRecipients: list of recipients, separated by spaces
  16. # $szSubject: subject of message
  17. # $szBody: HTML message body
  18. #
  19. # Result:
  20. # (void)
  21. #
  22. # 08JAN99 GaryKac began
  23. #------------------------------------------------------------------------------
  24. # this uses the OLE package
  25. use Win32::OLE;
  26. sub SendHtmlMail
  27. {
  28. my($szRecipients, $szSubject, $szBody) = @_;
  29. my($rc) = 1;
  30. my($appOutlook) = Win32::OLE->new("Outlook.Application");
  31. $olMailItem = 0;
  32. if ($appOutlook)
  33. {
  34. my($MailItem) = $appOutlook->CreateItem($olMailItem);
  35. $Recipients = $MailItem->Recipients();
  36. foreach $recip (split(/\s+/,$szRecipients))
  37. {
  38. $Recipients->Add($recip);
  39. }
  40. $MailItem->{Subject} = $szSubject;
  41. $MailItem->{HTMLBody} = $szBody;
  42. $MailItem->Send();
  43. }
  44. else
  45. {
  46. print(STDERR "Unable to new an instance of Outlook (is it installed and properly configured?)\n\n");
  47. $rc = 0;
  48. }
  49. }
  50. $__IITSENDHTMLMAILPM = 1;
  51. 1;