Vous devez être membre et vous identifier pour publier un article.
Les visiteurs peuvent toutefois commenter chaque article par une réponse.

ENVOIE MAIL EN SMTP DEPUIS WINDOWS 2003 / ASP SANS COMPOSANT

Astuces de l’Infobrol (Développement)Article publié le 31/01/2005 10:32:38


Pour faire plaisir à Steph, ce code permet d'envoyer depuis un server ASP windows 2003 un mail sans composant suplement via un serveur mail SMTP avec controle d'identification. ;-)


  1. Const cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing"
  2. Const cdoSendUsingPort = 2
  3. Const cdoSMTPServer = "http://schemas.microsoft.com/cdo/configuration/smtpserver"
  4. Const cdoSMTPServerPort = "http://schemas.microsoft.com/cdo/configuration/smtpserverport"
  5. Const cdoSMTPConnectionTimeout = "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
  6. Const cdoSMTPAuthenticate = "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
  7. Const cdoBasic = 1
  8. Const cdoSendUserName = "http://schemas.microsoft.com/cdo/configuration/sendusername"
  9. Const cdoSendPassword = "http://schemas.microsoft.com/cdo/configuration/sendpassword"
  10.  
  11. Dim objConfig ' As CDO.Configuration
  12. Dim objMessage ' As CDO.Message
  13. Dim Fields ' As ADODB.Fields
  14.  
  15. ' Get a handle on the config object and it's fields
  16. Set objConfig = Server.CreateObject("CDO.Configuration")
  17. Set Fields = objConfig.Fields
  18.  
  19. ' Set config fields we care about
  20. With Fields
  21. .Item(cdoSendUsingMethod) = cdoSendUsingPort
  22. .Item(cdoSMTPServer) = "ServerSmtp"
  23. .Item(cdoSMTPServerPort) = 25
  24. .Item(cdoSMTPConnectionTimeout) = 20
  25. .Item(cdoSMTPAuthenticate) = cdoBasic
  26. .Item(cdoSendUserName) = "LOGIN"
  27. .Item(cdoSendPassword) = "Mot De Passe"
  28.  
  29. .Update
  30. End With
  31.  
  32. Set objMessage = Server.CreateObject("CDO.Message")
  33.  
  34. Set objMessage.Configuration = objConfig
  35.  
  36. With objMessage
  37. .To = "Adresse Mail destinataire"
  38. .From = "Adresse Mail emetteur"
  39. .Subject = "Sujet du mail"
  40. .TextBody = "Contenu du message a envoyer "
  41. .Send
  42. End With
  43.  
  44. Set Fields = Nothing
  45. Set objMessage = Nothing
  46. Set objConfig = Nothing


Avatar :: Akira Sato Un article de Akira SatoModifié 1 fois. (dernière modification le 09/05/2005 22:24:00 par Lea72)



Source : www.aspfr.com


Commenter l'article

Commentaires


09/05/2005 22:27:34 : Pas clair...

J'ai essayé de modifier ton message pour corriger l'orthographe, mais je ne comprend pas le sens de la première phrase ????
Tu sais le recomposer?
Merci.

- Lea72 -

Sélection, tri et recherche d'articles
FILTRER :
TRIER :1er critère : 2e critère :
CHERCHER : Dans les titres Dans le contenu


[Afficher les liens en fonction des critères du formulaire ci-dessus]

English translation

You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.

If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.

Thank you in advance.

Document created the 13/09/2004, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/ast-rf-196.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.