ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Send web mail from Excel (VBA)?? (https://www.excelbanter.com/excel-programming/368548-send-web-mail-excel-vba.html)

MaxS

Send web mail from Excel (VBA)??
 
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?


Ron de Bruin

Send web mail from Excel (VBA)??
 
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?




MaxS

Send web mail from Excel (VBA)??
 
Thanks a lot, Ron
Will check it now.

Best,

Max

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?



MaxS

Send web mail from Excel (VBA)??
 
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?



NickHK

Send web mail from Excel (VBA)??
 
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?





MaxS

Send web mail from Excel (VBA)??
 
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?




NickHK

Send web mail from Excel (VBA)??
 
Max,
Couldn't answer you on that one.
Ron's your man when it all things CDO.

NickHK

"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?






Ron de Bruin

Send web mail from Excel (VBA)??
 
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?






MaxS

Send web mail from Excel (VBA)??
 
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?





Ron de Bruin

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?







Ron de Bruin

Send web mail from Excel (VBA)??
 
Or the firewall block it

--
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?







MaxS

Send web mail from Excel (VBA)??
 
I think it is the firewall. When I ping smtp server all packages are
lost. However the code works fine on another network.

Thanks for the help!
Ron de Bruin wrote:

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?







All times are GMT +1. The time now is 11:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com