| 
Login
Inviare una email da Excel senza usare Outlook
(3 VOTITALY_VOTES, VOTITALY_AVERAGE: 5.00 VOTITALY_OUTOF)
Tips and Tricks - VBA: mini progetti

Con Excel è possibile spedire delle email attaverso le macro. Questa procedura descrive come spedire un email senza usare Outlook

Sub invia_email_CDO()

   Set mess = CreateObject("CDO.Message")
   Set config = CreateObject("CDO.Configuration")

   config.Load -1 ' CDO Source Defaults
   config.Fields.item(schemas.microsoft.com/cdo/configuration/sendusing)= 2
   config.Fields.item(schemas.microsoft.com/cdo/configuration/smtpserver) _
   = "smtp.xxx.eu" 'metti qui il tuo server smtp

   'autentiazione 1 NONE, 2 Basic (Base64 encoded), 3 NTLM
   config.Fields.item(schemas.microsoft.com/cdo/configuration/smtpauthenticate) = 1

   'account ID
   config.Fields.item(schemas.microsoft.com/cdo/configuration/sendusername) = " This e-mail address is being protected from spambots. You need JavaScript enabled to view it

   'password
   config.Fields.item(schemas.microsoft.com/cdo/configuration/sendpassword) = "xxxxx"

   config.Fields.item(schemas.microsoft.com/cdo/configuration/smtpserverport) = 25
   config.Fields.Update

   With mess
      Set .Configuration = config
      .To = Range("destinatario").Value
      .CC = ""
      .BCC = ""
      .From = " This e-mail address is being protected from spambots. You need JavaScript enabled to view it "
      .Subject = Range("oggetto").Value
      .TextBody = Range("testo").Value
      '.AddAttachment PercorsoAssolutoFileDaAllegare
   End With

   mess.Send

End Sub

 

Progetto postato da davideba a questo url.

Grazie Davide :)