ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   send a mail from VBA / excel (https://www.excelbanter.com/excel-programming/390415-send-mail-vba-excel.html)

rhXX

send a mail from VBA / excel
 
hi all,

how can i send a mail from excel using VBA.

that is, i have a program in excel (VBA) and at the end i obtain a
text file with the results.

i need to send a simple mail (TO:, SUBJECT: ) with this text info as
body of the mail.

i would like when i "click" my program, at the end it send this mail

tks in advance


Keith74

send a mail from VBA / excel
 
Have a look at this website

http://www.rondebruin.nl/sendmail.htm

hth

Keith


rhXX

send a mail from VBA / excel
 
keith,

tks, nice!

i already tested and works ok writting the mail in the outlook outbox!

BUT, i have a problem, i am not used outlook, but mozilla firefox, so
i need to access to mozilla outbox, or connect directly to email
server (?????)

sorry i didn't explain complete in my first post :-(

any ideas?

tks in advance.

On May 31, 12:27 pm, Keith74 wrote:
http://www.rondebruin.nl/sendmail.htm




Keith74

send a mail from VBA / excel
 
sry, can't help here, no expereience of that at all

did find this after a quick search on the net

http://www.paulsadowski.com/WSH/cdo.htm



rhXX

send a mail from VBA / excel
 
On May 31, 1:01 pm, Keith74 wrote:
http://www.paulsadowski.com/WSH/cdo.htm



keith, tks a lot!!!!!

that page shows how to use MS CDO

- i enabled its reference, and worked fine with the simple example

Sub Mail1()
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Example CDO Message"
objMessage.From = "
objMessage.To = "
objMessage.TextBody = "This is some sample message text."

'==This section provides the configuration information for the remote
SMTP server.
'==Normally you will only change the server name or IP.

objMessage.Configuration.Fields.item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
= "smtp.toto.com"

'Server port (typically 25)
objMessage.Configuration.Fields.item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

objMessage.Configuration.Fields.Update

'==End remote SMTP server configuration section==

objMessage.Send

End Sub


Norman Jones

send a mail from VBA / excel
 
Hi RH,

Yo have solved your problem now, but you couuld
have used Ron de Bruin's CDO page at the site
originally suggested by Keith:


Sending mail from Excel with CDO
http://www.rondebruin.nl/cdo.htm



---
Regards,
Norman



"rhXX" wrote in message
oups.com...
On May 31, 1:01 pm, Keith74 wrote:
http://www.paulsadowski.com/WSH/cdo.htm



keith, tks a lot!!!!!

that page shows how to use MS CDO

- i enabled its reference, and worked fine with the simple example

Sub Mail1()
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Example CDO Message"
objMessage.From = "
objMessage.To = "
objMessage.TextBody = "This is some sample message text."

'==This section provides the configuration information for the remote
SMTP server.
'==Normally you will only change the server name or IP.

objMessage.Configuration.Fields.item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
= "smtp.toto.com"

'Server port (typically 25)
objMessage.Configuration.Fields.item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

objMessage.Configuration.Fields.Update

'==End remote SMTP server configuration section==

objMessage.Send

End Sub




rhXX

send a mail from VBA / excel
 
On May 31, 2:01 pm, "Norman Jones"
wrote:

Sending mail from Excel with CDO
http://www.rondebruin.nl/cdo.htm


oh yes. in that site i only saw sendmail ..... :-(

i will check the site

tks!



All times are GMT +1. The time now is 05:12 PM.

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