View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Send web mail from Excel (VBA)??

Maybe at work you need this

When you also get the Authentication Required Error you can add this three
lines..Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
..Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "username"
..Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"
--
Regards Ron de Bruin
http://www.rondebruin.nl



"MaxS" wrote in message ups.com...
well, I did use those lines - they are just ugly formatted in the
message above. And I know that this code did work without Outlook at my
home - I got ony gmail account and not mail clinent.

Thank you.

Ron de Bruin wrote:

Hi Max

If you not have a account in Outlook Express you must use the commented code lines in the examples on my site.
Read the text on my site

--
Regards Ron de Bruin
http://www.rondebruin.nl



"MaxS" wrote in message oups.com...
Thanks Nick!
I indeed missed that. Now however I get another error "The SendUsing
configuration value is invalid" but this probably has something to do
with company security settings, I guess..


NickHK wrote:

Max,
At a guess, it looks like you have a extra leading space in "
CDO.Configuration".

NickHK

"MaxS" wrote in message
oups.com...
Hi Ron,

your site helped and I could send the message via my gmail account.
However when I run the same code from work i get the following message:

"ActiveX component can't create object" on the line of code
"Set iConf = CreateObject(" CDO.Configuration")"

I have Win XP and Office 2002 at home and in the office. So the systems
are the same.

Any ideas why this can happen?

Here goes my code:

Sub Mail_Small_Text_CDO()
Dim iMsg As Object
Dim iConf As Object
Dim strbody As String
Dim Flds As Variant

Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject(" CDO.Configuration")

' iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds
.Item("
http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate
") = 1

.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"smtp.gmail.com "

.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")
= 465
.Item("
http://schemas.microsoft.com/cdo/configuration/sendusername") =
"
.Item("
http://schemas.microsoft.com/cdo/configuration/sendpassword") = "my
pass"

.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl ") =
True
.Update
End With

strbody = "Hi there" & vbNewLine & vbNewLine & _
"This is line 1" & vbNewLine & _
"This is line 2" & vbNewLine & _
"This is line 3" & vbNewLine & _
"This is line 4"
With iMsg
Set .Configuration = iConf
.To = "
.CC = ""
.BCC = ""
.From = """MasS"" < "
.Subject = "Important message"
.TextBody = strbody
.Send
End With



Set iMsg = Nothing
Set iConf = Nothing
End Sub












Ron de Bruin wrote:

Hi MaxS

Try CDO
http://www.rondebruin.nl/cdo.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl



"MaxS" wrote in message
oups.com...
Hi,

is it possible to do the following in VBA:

I run a lenthy simulation on another computer and would like the
program to send me an emai when it is finished.

If I do this using MS Outlook i get a security warning which asks to
press "OK". So not much automation after all.
Can I send an email automatically using a web email account like gmail
or hotmail?


Thanks a lot?