| View previous topic :: View next topic |
| Author |
Message |
mrexcel General User

Joined: 13 Apr 2012 Posts: 6
|
Posted: Fri Apr 13, 2012 7:26 am Post subject: Send Gmail |
|
|
| Any one can help me to waite a macro to send some words by Gmail account using cdo & smtp?Million thanks. |
|
| Back to top |
|
 |
mrexcel General User

Joined: 13 Apr 2012 Posts: 6
|
Posted: Fri Apr 13, 2012 7:27 am Post subject: |
|
|
| And any method but outlook is welcome |
|
| Back to top |
|
 |
mrexcel General User

Joined: 13 Apr 2012 Posts: 6
|
Posted: Sat Apr 14, 2012 8:48 am Post subject: |
|
|
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 |
|
 |
mrexcel General User

Joined: 13 Apr 2012 Posts: 6
|
Posted: Mon Apr 16, 2012 4:52 am Post subject: |
|
|
| Anyone can help me? |
|
| Back to top |
|
 |
|