Antworten

E-Mails mit ASP versenden

Das nachfolgende Script-Beispiel stellt Ihnen einen funktionierenden ASP E-Mail-Script zur Verfügung, welcher unter Verwendung von Collaboration Data Object (CDO) Nachrichten versendet:

  1. <%
  2. Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory.
  3. Const cdoSendUsingPort = 2 'Send the message using the network(SMTP over the network).
  4. Const cdoAnonymous = 0 'Do not authenticate
  5. Const cdoBasic = 1 'basic(clear - text) authentication
  6. Const cdoNTLM = 2 'NTLM
  7. Set objMessage = CreateObject("CDO.Message")
  8. objMessage.Subject = "hostfactory.ch ASP - CDO Ihre Testnachricht"
  9. objMessage.From = "ihre@gueltigeAdresse.ch"
  10. objMessage.To = "recipient@empfaenger.ch"
  11. objMessage.Cc = "secondrecipient@empfaenger.ch"
  12. objMessage.TextBody = "Dies ist eine Testnachricht über ASP / CDO" & vbCRLF & "Diese Nachricht wurde mit SMTP-Auth. versandt (zwingend!)."
  13. ' == This section provides the configuration information for the remote SMTP server.
  14. objMessage.Configuration.Fields.Item _
  15. ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
  16. 'Name or IP of Remote SMTP Server
  17. objMessage.Configuration.Fields.Item _
  18. ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
  19. 'Type of authentication, NONE, Basic(Base64 encoded), NTLM
  20. objMessage.Configuration.Fields.Item _
  21. ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
  22. 'Your UserID on the SMTP server
  23. objMessage.Configuration.Fields.Item _
  24. ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "absender@ihreDomain.ch"
  25. 'Your password on the SMTP server
  26. objMessage.Configuration.Fields.Item _
  27. ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "pASSwoRd"
  28. 'Server port (typically 25)
  29. objMessage.Configuration.Fields.Item _
  30. ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
  31. 'Use SSL for the connection(False or True)
  32. objMessage.Configuration.Fields.Item _
  33. ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
  34. 'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
  35. objMessage.Configuration.Fields.Item _
  36. ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
  37. objMessage.Configuration.Fields.Update
  38. ' == End remote SMTP server configuration section ==
  39. objMessage.Send
  40. %>

Bitte beachten Sie, dass alle oben gesetzten Werte in Rot wie 'Benutzername', 'Empfängeradresse' usw. durch gültige persönliche Werte zu ersetzen sind.

Damit Sie einen gültigen Benutzernamen (vollständige Mailadresse) sowie ein gültiges Passwort angeben können, müssen Sie dieses Postfach vorgängig in Ihrem Kunden-Center erstellen und Zugangsdaten vergeben: my.hostfactory.ch » 'Webhostings' » (allf. Webhosting wählen) » (Domain wählen) » 'E-Mail'

Dieser Artikel ist nur für Windows-Hosting Accounts gültig, auf Linux steht kein ASP-Support zur Verfügung.

Link zu diesem Artikel: https://support.hostfactory.ch/artikel/mails-mit-asp-versenden/
URL in Zwischenablage kopieren