DenkzeitWiki

Suchen:

Aktuelle Änderungen Printable View Änderungen Bearbeiten

VersionControl > JohannesSiedersleben > PythonSuccessStories > TailCallOptimization > Recursion > BehaviorDrivenDesign > SmartDataAndDumbCode > ProgrammingLanguages > ProgrammierSprachen > JavaEnterpriseEdition > DataDrivenProgramming > TestDrivenDevelopment > ClojureReferenceTypes > VersionControlSystems > VersionControl > FunctionalProgramming > SomeOfMyPythonScriptsClear Trail
Main /

Some Of My Python Scripts

Python
PythonWindowsProgramming

PSPadScripts

Register + Unregister COM-Server

The following snippet replaces some call to regsrv32.exe:
from ctypes import oledll
dll = oledll[r'C:\path\to\some.dll']
dll.DllRegisterServer()
dll.DllUnRegisterServer()
Throws WindowsError if error occurs.

Send email via Outlook

import win32com.client

def send_mail_via_com(text, subject, recipient, profilename="Outlook2003"):
    s = win32com.client.Dispatch("Mapi.Session")
    o = win32com.client.Dispatch("Outlook.Application")
    s.Logon(profilename)
    
    Msg = o.CreateItem(0)
    Msg.To = recipient
    
    Msg.CC = "WeitereAdressaten"
    Msg.BCC = "Mailadresse"
    
    Msg.Subject = subject
    Msg.Body = text
    
    Anhang1="Pfad zum Anhang1"
    Anhang2="Pfad zum Anhang2"
    Msg.Attachments.Add(Anhang1)
    Msg.Attachments.Add(Anhang2)
 
    Msg.Send()

Edit - BackLinks - Tags - Page Hist - Print - Changes - Home - Orphans - Help

Zuletzt geändert am 16.12.2006 15:07 Uhr und seit 7. April 2005 3178 aufgerufen.