OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

email via MailServiceProvider

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
DrewJensen
Super User
Super User


Joined: 06 Jul 2005
Posts: 2616
Location: Cumberland, MD

PostPosted: Sun Aug 27, 2006 3:47 pm    Post subject: email via MailServiceProvider Reply with quote

Two questions.

First - has anyone managed to get the "com.sun.star.mail.MailServiceProvider" services to work using OOBasic?

Second - My understanding is that there is a Python script that does work. Does anyone know where I can download a copy of that script?

Anyway - I have tried to use the code I found on the lists, with SMTP and Gmail. Follwoing is my test code. I blanked out the username and password - otherwise it is unchanged from my machine.

Code:

Sub MailService()

   oMailProvider = CreateUNOService("com.sun.star.mail.MailServiceProvider")

   oCont = CreateUNOListener("CurCont_","com.sun.star.uno.XCurrentContext")
   oAuth = CreateUNOListener("Authent_","com.sun.star.mail.XAuthenticator")
   oMailServer = oMailProvider.Create("com.sun.star.mail.SMTP")

   oMailServer.Connect(oCont,oAuth)
   msgbox xMailServer.isConnected
   
   oMsg=CreateUnoService("com.sun.star.mail.MailMessage")
   oMsg.Create("drewjensen.inbox@gmail.com", "andrew@paintedfrogceramics.com", "Hi from OOot", "Hello there - Me")

   oMailServer.Disconnect()

End Sub

Function CurCont_GetValueByName(s) as Any

   Select Case s
    Case "ServerName"
     CurCont_GetValueByName = "smtp.gmail.com"
    Case "Port"
     CurCont_GetValueByName = 465
    Case "ConnectionType"
     CurCont_GetValueByName = "SSL"
   End Select

End Function

Function Authent_GetUserName() as Any
   Authent_GetUserName = "xxxxxxxxxxxxx"
End Function

Function Authent_GetPassword()
   Authent_GetPassword = "xxxxxxxxxx"
End Function


Using the latest developers build this code when run goes off for a good while, my firewatl pops up asking if I should let sofice.exe connect to the internet - I say yes, and finally it throws the following error

Quote:

BASIC runtime error
An exception orrurred
Type: com.sun.star.uno.RuntimeException
Message: socket.error:(10054,"Connection reset by peer'), trackback follows...( trace back into smtplib.py )

apparently this is handled in a python library within OOo.


Interestingly if I check the firewall logs I find this as the last entry after doing this:

Quote:

Application Hijacking has been detected
The application: C:\Program Files\OOo-dev 2.0\program\soffice.exe try to launch another application: C:\Program Files\OOo-dev 2.0\program\soffice.bin to go to remote host pop.gmail.com


Right now I am hoping someone can point me to that Python script that supposedly works.

Thanks

Drew
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ms777
Super User
Super User


Joined: 07 Feb 2004
Posts: 1355

PostPosted: Sun Aug 27, 2006 4:05 pm    Post subject: Reply with quote

one cross references to the sad story of the MailMessage service ...
http://www.oooforum.org/forum/viewtopic.phtml?t=29820

... and a python script by Caolan mentioned in above thread ( I never tried, would be curious to see some examples):
http://people.redhat.com/caolanm/mailmerge/mailmerge.py

Some discussions on the dev mailing list:
http://api.openoffice.org/servlets/BrowseList?list=dev&by=thread&from=1335840

Good luck, nonetheless...

ms777
Back to top
View user's profile Send private message
Peter
OOo Enthusiast
OOo Enthusiast


Joined: 28 May 2004
Posts: 105
Location: Berlin / Germany

PostPosted: Mon Aug 28, 2006 6:00 am    Post subject: Reply with quote

and the issue:
http://qa.openoffice.org/issues/show_bug.cgi?id=51638
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group