LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-20-2007, 11:19 PM   #1
298
LQ Newbie
 
Registered: Apr 2007
Distribution: Ubuntu & Debian
Posts: 16

Rep: Reputation: 0
MrPostman Outlook 2003 Configuration


My company was purchased by another one, and the new company's Exchange server doesn't support POP like the old one did. Since I don't want to use Outlook again, I was looking into MrPostman. Does anyone know how to configure this to work with Outlook 2003 Web Access?

When I log in to the webmail using a browser, I just have to punch in my user name and a password. The user name is just one word, no email address, no domain name.

In MrPostman I am a bit confused about the "mail extension" field. If I fill in something, I get an error in the log '@company.com': Login unsuccessful, if don't provide anything, I get errors that the user name needs to be an email address.

Or does anyone have some better ideas how I could get my company email into my Linux box? I've been using Getmail -> Procmail -> Dovecot -> Thunderbird(s), and I'd like to stick with that. The "approved" way is to use Outlook with RPC over HTTPS. (FreePops doesn't seem to support OWA and pop2owa doesn't run under wine.)
 
Old 06-25-2007, 10:46 PM   #2
298
LQ Newbie
 
Registered: Apr 2007
Distribution: Ubuntu & Debian
Posts: 16

Original Poster
Rep: Reputation: 0
Lightbulb

MrPostman works! No need to use M$ Outlook.

Below is an updated script file (outlook2003.script) that works with my company's OWA. All changes are marked with my initals (dh). There were some problems in the syntax of the URLs, and the handling of the user name needed to be changed as well. The OWA at my company uses a short name (bgates) for the logon and then it uses the full name with a dot (Bill.Gates) in the inbox URLs. The modified script can handle this. In the POP client you would have to use a user name like
Code:
Bill.Gates--bgates@microsoft.hell
If the two dashes between the two name parts are a problem because you have two dashes in your logon ID, you'd have to change the match conditions in lines 129 and 185. The script should also work with only one name part.

If there are other problems, I suggest that you switch on all the traces in MrPostman and that you compare the HTML it sends with what Firefox or any other browser would do when you use OWA directly. Then you could modify the script so that it mimics the browser exactly.


Code:
# Outlook Web Access 2003
# Supports attachments, html email, calendar invites and sending.
#
#------------------------------------------------------------------
#  (dh)   modified in order to handle short user names for logon
#  (dh)   and long names in the inbox URL
#  (dh)   2007-06-26
#------------------------------------------------------------------
# 
# @Requires: 1.1 beta3
# @Version: 0.8.2
#    visible version number corrected
# @Version: 0.8.1
#    fix problem with special chars in messages id 
#    Permanently delete all items and subfolders in the Deleted Items folder 
# @Version: 0.8
#    Minor fix to address parsing, now removes commas in names.
#    Added handling of embedded images, calendar invites and sending (including attachments).
# @Version: 0.7.1
#    german texts (with MrPostman 1.2.2+)
# @Version: 0.7
#    (martin.vlcek) Log in using basic authorization
# @Version: 0.6
#    Attachments of messages an ID containing [ or ] can now be downloaded
# @Version: 0.5
#    Able to parse messages with "undisclosed recipients"
# @Version: 0.4
#    Multiple mailaddresses are now separated by commas and newlines instead of semicolons.
# @Version: 0.3.1
#    ordering of options in configuration dialog
#    allow multiple extensions
#    use generic default values for settings
# @Version: 0.3
#    header parsing does not fail when return address is specified
#    messages with an ID containing [ or ] can now be downloaded
# @Version: 0.2
#    Allow Multiple pages
#    remove hardcoded https://webmail.ua.ac.be
# @Version: 0.1
#    initial version

sub getInfo
	local(info)
	info.name = "outlookWA 2003 v0.8 modif (dh)"
	info.authors[0] = "Steven.Aerts <steven.aertsATgmail.com>"
	info.authors[1] = "Jon Denly <jonnydeeATgmail.com>"
	info.authors[2] = "Luca Corbo <lu.corbo@gmail.com>"
	info.version = "0.8.2"
	info.updateService = ""
	info.documentationLink = ""
	info.options["extension"].value = "@mycompany.com"
	info.options["extension"].label = "Mail Extensions"
	info.options["extension"].description = "Extensions (include the @!) separated by ','"
	info.options["extension"].order = 1
	info.options["isHttp"].value = false
	info.options["isHttp"].label = "Use HTTP"
	info.options["isHttp"].description = "Use HTTP rather than HTTPS for sign on"
	info.options["isHttp"].order = 2
	info.options["host"].value = "webmail.mycompany.com"
	info.options["host"].label = "Server Name"
	info.options["host"].description = "Set to the server name, which you would access for the mail extension"
	info.options["host"].order = 3
	info.options["locale"].value = "de"
	info.options["locale"].label = "Locale"
	info.options["locale"].description = "Locale, e.g. 'de' (German), 'en' (English)" 
	info.options["locale"].order = 4
	info.options["dateFormat"].value = "dd/MM/yyyy HH:mm"
	info.options["dateFormat"].label = "Date Format"
	info.options["dateFormat"].description = "Format of the date in Java SimpleDateFormat syntax"
	info.options["dateFormat"].order = 5
	info.options["delete"].value = false
	info.options["delete"].label = "Empty Deleted Items"
	info.options["delete"].description = "Permanently delete all items and subfolders in the Deleted Items folder"
	info.options["delete"].order = 7

	#--- german texts
	info.options["extension"].de.label = "E-Mail-Endungen"
	info.options["extension"].de.description = "E-Mail-Endungen (mit @) getrennt durch ','"
	info.options["isHttp"].de.label = "HTTP verwenden"
	info.options["isHttp"].de.description = "HTTP anstatt HTTPS verwenden"
	info.options["host"].de.label = "Server-Name"
	info.options["host"].de.description = "Der Name des Servers, der die E-Mails mittels OWA bereitstellt"
	info.options["locale"].de.label = "Sprache"
	info.options["locale"].de.description = "Sprache der OWA-Installation, z.B. 'de' (Deutsch), 'en' (Sprache)" 
	info.options["dateFormat"].de.label = "Datumsformat"
	info.options["dateFormat"].de.description = "Format des Datums in Java SimpleDateFormat-Syntax (siehe Hilfe)"
	return info
end

sub getExtensions
	# more fault tolerant in regard to separators than specified in description
	return split(info.options["extension"].value,"[\s,;]+")
end

sub login(username,password)
	local(found,domain,user,mailext,pattern_mainframe)
	found,domain,user,mailext = match(username,"([^\\\]+)\\\(.+)@(.*)")
	# sometimes no domain is required
	if (!found)
		found,user,mailext = match(username,"(.+)@(.*)")
		domain = ""
	end
	failif(!found,"Invalid user name - must be \"auth-domain\\username@mail-domain\" or \"username@mail-domain\"!")
	baseurl = iif(info.options["isHttp"].value,"http://","https://") & info.options["host"].value
	setbaseurl(baseurl)
	size.locale = info.options["locale"].value
	size.unit = map("B",1,"KB",1024,"MB",1024*1024,"GB",1024*1024*1024)
	date.locale = info.options["locale"].value
	date.format = info.options["dateFormat"].value
	
	desturl = baseurl & "/exchange/"
	params = map("destination",desturl, "username", iif(domain=="",user,domain & "\\" & user), "password", password)
	status, page = post("/exchweb/bin/auth/owaauth.dll", params)
	if (status != 200)
		# sometimes log in is by accessing the home page and basic authorization
		addcredentials(iif(domain=="",user,domain&"\\"&user),password)
		status, page = get(baseurl)
		failif(status != 200, "Error logging in: http return code " & status)
	end
	return page,user
end

sub loginForReceive(username,password)
	local(url,status,page,found,pattern_msgframe,pattern_msgline,user,user1,user2,pagemsgs,currentPage,nrOfPages)

        # (dh)   split username into two parts
        # (dh)   for example Peter.Smith and psmith@company.com
        # (dh)   the first will be used inbox URLs, the second for logon
        found,user1,user2 = match(username,"(.+)--(.+)")
        if (!found)
                user1 = username
                user2 = username
        end

	page,user = login(user2,password)
	pattern_msgframe  = "\"([^\?\"]+)/\?Cmd=contents\""
	setbaseurl(iif(info.options["isHttp"].value,"http://","https://") & info.options["host"].value & "/" & "exchange/" & user1 & "/")
	found,postbox=match(page,pattern_msgframe)
	url = postbox & "/?Cmd=contents"
	status,page = get(url)
	failif(status!=200,"Error retrieving message list frame!")
	found,nrOfPages = match(page,"name=\"Page\"(?:[^>]+>){3,3}&nbsp;[\w]+&nbsp;(\d+)")
	nrOfPages = integer(nrOfPages)
	currentPage = 1
	msgs=list()
	while (currentPage <= nrOfPages)
		if (currentPage > 1)
			status,page = get(url & "&Page=" & currentPage)
			failif(status!=200,"Error retrieving message list frame!")
		end
		pattern_msgline   = "\"([^\\?\"]+/[^\"]+\\.EML\\?Cmd=open)\"><[^>]+>(?:<b>)?(\\d+)&nbsp;(B|KB|MB|GB)<"
		pagemsgs=list()
		numfound,pagemsgs[].id,pagemsgs[].size.value,pagemsgs[].size.unit = matchall(page,pattern_msgline)
		foreach (pagemsgs, pagemsg)
			pagemsg.id = encodeUrl(pagemsg.id)
		end
		msgs = join(msgs, pagemsgs)
		currentPage = currentPage + 1
	end
	return true
end

sub receive(msg)
	local(status,page,params,headers)
	params[""] = ""
	
	# use this header to make OWA return the raw message
	headers["Translate"] = "f"

        # (dh)   URL fixes
	msg.id = replaceall(msg.id,"Inbox%2F","Inbox/")
	msg.id = replaceall(msg.id,"%3FCmd%3Dopen","?Cmd=open")
	
	status,page = get(replaceall(replaceall(msg.id,"\\[","%5B"), "\\]", "%5D"),params,headers)
	msg.raw.text = page
	return msg
end

sub loginForSend(username,password)
	local(baseurl,url,status,page,found,pattern_msgframe,pattern_msgline,user,user1,user2,pagemsgs,currentPage,nrOfPages)

        # (dh)   split username into two parts
        # (dh)   for example Peter.Smith and psmith@company.com
        # (dh)   the first will be used inbox URLs, the second for logon
        found,user1,user2 = match(username,"(.+)--(.+)")
        if (!found)
                user1 = username
                user2 = username
        end

	page,user = login(user2,password)
	pattern_msgframe  = "\"([^\?\"]+)/\?Cmd=contents\""
	baseurl = iif(info.options["isHttp"].value,"http://","https://") & info.options["host"].value & "/" & "exchange/" & user1 & "/"
	setbaseurl(baseurl)
	url = baseurl & "/Drafts/?Cmd=new"
	status,page = get(url)
	newlink = baseurl & "/Drafts"
	failif(status!=200,"Error retrieving message send frame!")
	return true
end
	
sub send(msg)
	local(status,page,params,attachlink,filemap,pattern_basehref,basehref,pattern_attachsend,aparams)
	
	params["MsgTo"]  = replaceAll(msg.to,",",";")
	params["MsgCc"]  = replaceAll(msg.cc,",",";")
	params["MsgBcc"] = replaceAll(msg.bcc,",",";")
	params["urn:schemas:httpmail:subject"]   = msg.subject
	params["urn:schemas:httpmail:textdescription"]   = msg.text
	params["Cmd"] = "send"
	params["CmdReferring"] = "new"
	params["ReceiptOptions"] = "0"
	params["urn:schemas:httpmail:importance"] = "1"
	params["MsgID"] = ""
	params["Embedded"] = "0"
	params["ReadForm"] = "1"
	params["Index"] = ""
	params["Action"] = "Cancel"
	params["http://schemas.microsoft.com/exchange/deliveryreportrequested"] = ""
	params["http://schemas.microsoft.com/exchange/readreceiptrequested"] = ""
	
	# if there are any attachments, go to the attachment page
	if (size(msg.attachments) > 0)
		params["Cmd"] = "editattach"
		status,page = post(newlink,params)
		
		# now grab the base url from the page
		pattern_basehref="<BASE href=\"([^\"]+)\" />"
		found,basehref=match(page,pattern_basehref)
		
		# set the main post link to the correct send from the attachments page
		pattern_attachsend="<FORM NAME=\"MainForm\"\r\nACTION=\"([^\"]+)"
		found,newlink=match(page,pattern_attachsend)
		
		# now construct the new link to post the attachment to
		attachlink = basehref & "?Cmd=addattach&Embedded=0&Target="
		foreach (msg.attachments, attachment)
			filemap = map()
			filemap["attachFile"] = attachment.link
			status,page = postMultipart(attachLink,filemap)
		end
		
		# set the params to send from the attachment page
		aparams["Embedded"] = "0"
		aparams["Cmd"] = "send"
		
		status,page = post(newlink,aparams)
		return (status == 200)
	end
	status,page = post(newlink,params)
	return (status == 200)
end

sub encodeUrl(urlToEncode)
	local(urlEncoded)
	urlEncoded = replaceall(urlencode(urldecode(urlToEncode)), "\+", "%20")
 	return urlEncoded			 
end


sub delete(msgs)
	local(msg, status, page)
	foreach(msgs, msg)
		status,page = post(msg.id, map("MsgID", "/" & replaceall(msg.id, "\?.*", ""), "Cmd", "delete"))
	end
	
        if (info.options["delete"].value)
          get("?Cmd=emptydeleteditems&sessid=" & replace(getcookie("sessionid"),"\:.*",""))
        end 

	return true
end

sub logout
	get("?Cmd=logoff")
	return true
end
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook 2003 to Evolution migration cenora Linux - Newbie 1 02-28-2007 11:34 PM
Set up Fetchmail for use with MrPostman? shotokan Linux - Software 1 07-25-2006 08:41 PM
evolution outlook exchange configuration sailajabhandaru Linux - Software 0 12-08-2005 06:14 AM
fetchyahoo,yosucker or mrpostman mithereal Linux - General 1 08-26-2005 10:13 PM
java & mrpostman myonta Linux - Newbie 4 10-08-2004 05:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration