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

Send Gmail

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


Joined: 13 Apr 2012
Posts: 6

PostPosted: Fri Apr 13, 2012 7:26 am    Post subject: Send Gmail Reply with quote

Any one can help me to waite a macro to send some words by Gmail account using cdo & smtp?Million thanks.
Back to top
View user's profile Send private message
mrexcel
General User
General User


Joined: 13 Apr 2012
Posts: 6

PostPosted: Fri Apr 13, 2012 7:27 am    Post subject: Reply with quote

And any method but outlook is welcome
Back to top
View user's profile Send private message
mrexcel
General User
General User


Joined: 13 Apr 2012
Posts: 6

PostPosted: Sat Apr 14, 2012 8:48 am    Post subject: Reply with quote

I found some codes in oooforum.org,but it did not work.
Code:

Sub SendGmail()

   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("mymail@gmail.com", "Mymail@gmail.com", "Hi from OOot", "Hello there - Me")

   oMailServer.Disconnect()
msgbox "ok"
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 = "Myname"
End Function

Function Authent_GetPassword()
   Authent_GetPassword = "Mypassweord"
End Function

Anyone can help me?
Back to top
View user's profile Send private message
mrexcel
General User
General User


Joined: 13 Apr 2012
Posts: 6

PostPosted: Mon Apr 16, 2012 4:52 am    Post subject: Reply with quote

Anyone can help me?
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