While migrating an application from an old IIS4(NT) server to a new win2003 machine there were some errors with emails.

It's always better to use a default component over a 3th party tool. That's why you should use CDO.

CDO (Collaboration Data Objects) is a Microsoft technology that is designed to simplify the creation of messaging applications.

However there are 2 versions of CDO: CDOSYS and CDONT.

Microsoft doesn't support CDONTs anymore on win2k/XP and 2k3.

So the only thing i had to change to make it work, was to change te version.

The code below works on windows 2003.

ASP:
  1. <%
  2. Set myMail=CreateObject("CDO.Message")
  3.  
  4. myMail.Subject="test"
  5. myMail.From="name@domain.com"
  6. myMail.To="name@domain.com"
  7. myMail.TextBody="test"
  8.  
  9. myMail.Configuration.Fields.Item _
  10. ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
  11. 'Name or IP of remote SMTP server
  12. myMail.Configuration.Fields.Item _
  13. ("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
  14. ="relay1.smtp.local"
  15. 'Server port
  16. myMail.Configuration.Fields.Item _
  17. ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _
  18. =25
  19. myMail.Configuration.Fields.Update
  20.  
  21. myMail.Send
  22.  
  23. set myMail=nothing
  24. response.write "mail send succesfully"

Popularity: 7% [?]