A
Astan Chee
Hi,
I don't know if my last mail made it or not but here it is again.
I'm trying to launch standard mail app in windows and after looking
around most look like this:
import urllib, webbrowser, win32api
def mailto_url(to=None,subject=None,body=None,cc=None):
"""
encodes the content as a mailto link as described on
http://www.faqs.org/rfcs/rfc2368.html
"""
url = "mailto: " + urllib.quote(to.strip(),"@,")
sep = "?"
if cc:
url+= sep + "cc=" + urllib.quote(cc,"@,")
sep = "&"
if subject:
url+= sep + "subject=" + urllib.quote(subject,"")
sep = "&"
if body:
# Also note that line breaks in the body of a message MUST be
# encoded with "%0D%0A". (RFC 2368)
body="\r\n".join(body.splitlines())
url+= sep + "body=" + urllib.quote(body,"")
sep = "&"
return url
url = mailto_url(txtTo,txtSubject,body,txtCC)
# win32api.ShellExecute(0,'open',url,None,None,0)
webbrowser.open(url,new=1)
# os.startfile(url)
all of these are having "WindowsError : [Error 5] Access is denied"
errors. I'm using windows xp and python 2.5. I have outlook 2007
installed as a default mail client. Clicking on any mailto links in html
brings up the normal write mail from the mail client. Any ideas why this
is happening or how do I debug what access is being denied?
Thanks for any help
Astan
I don't know if my last mail made it or not but here it is again.
I'm trying to launch standard mail app in windows and after looking
around most look like this:
import urllib, webbrowser, win32api
def mailto_url(to=None,subject=None,body=None,cc=None):
"""
encodes the content as a mailto link as described on
http://www.faqs.org/rfcs/rfc2368.html
"""
url = "mailto: " + urllib.quote(to.strip(),"@,")
sep = "?"
if cc:
url+= sep + "cc=" + urllib.quote(cc,"@,")
sep = "&"
if subject:
url+= sep + "subject=" + urllib.quote(subject,"")
sep = "&"
if body:
# Also note that line breaks in the body of a message MUST be
# encoded with "%0D%0A". (RFC 2368)
body="\r\n".join(body.splitlines())
url+= sep + "body=" + urllib.quote(body,"")
sep = "&"
return url
url = mailto_url(txtTo,txtSubject,body,txtCC)
# win32api.ShellExecute(0,'open',url,None,None,0)
webbrowser.open(url,new=1)
# os.startfile(url)
all of these are having "WindowsError : [Error 5] Access is denied"
errors. I'm using windows xp and python 2.5. I have outlook 2007
installed as a default mail client. Clicking on any mailto links in html
brings up the normal write mail from the mail client. Any ideas why this
is happening or how do I debug what access is being denied?
Thanks for any help
Astan