views:

870

answers:

4

We have inherited a classic ASP site from a design agency who just wanted us to do a search and replace to change SMTP hosts. No problem, we are a PHP shop but can turn our hands to most things.

On further investigation it was discovered that we need to authenticate with the new SMTP server.

A bit of googling lead us to believe that it is using ASPMail 4 and according to the docs it doesn't do authentication.

http://www.serverobjects.com/comp/Aspmail4.htm

We just googled "SMTPsvg.Mailer" from this call:

Set Mailer = Server.CreateObject("SMTPsvg.Mailer")

Am I correct in my assumptions that the above is ASPMail 4, and the APSMAil doesn't do authentication?

What can I use to authenticate with a SMTP server if I need to replace Aspmail?

+1  A: 

Check if the hosting provider supports .Net Framework 2.0 (most do), if so rename the .asp file to .aspx, remove the code that sends the email and write some easy code:

http://www.systemwebmail.com/faq/3.8.aspx

Regards

Thomas

Thomas
Unfortunately, porting existing ASP pages to ASP.NET pages is almost never as easy as simply renaming the file extension from .asp to .aspx because, among other factors, there are significant differences between Microsoft Visual Basic Scripting Edition (VBScript) and Visual Basic .NET. from : http://msdn.microsoft.com/en-us/library/ms973813.aspx
Shoban
Not necessarily he need to rewrite the whole page, only making a `mailsender.aspx` that accepts the data needed as POST data, sends the mail and returns a result value. Better than using CDO in my opinion.
Eduardo Molteni
+2  A: 

Yes True. Why don't you change to CDO? This article can be of some help.

How do I send e-mail with CDO?

Shoban
A: 

According to the docs here ASPMail 4.x just doesn't support authentication. It looks like you'll have to switch to a different COM-based SMTP component.

Dave Swersky
he has given the link in his question :)
Shoban
I didn't down vote BTW :)
Shoban
Why exactly does reposting the same link earn a downvote when my answer is otherwise identical to the top-voted question? Just wondering.
Dave Swersky
I don't have enough rep to down vote. However it might be due to the fact you linked to the same docs that i linked to in my question stating the same as I did that the docs say it doesn't support authentication.
johnwards
+4  A: 

As said, use CDO.

set config = CreateObject("CDO.Configuration")
sch = "http://schemas.microsoft.com/cdo/configuration/"
with config.Fields
 .item(sch & "sendusing") = 2 ' cdoSendUsingPort
 .item(sch & "smtpserver") = application("smtpserver")
 .item(sch & "smtpserverport") = application("smtpserverport")
 .item(sch & "smtpauthenticate") = 1 'basic auth
 .item(sch & "sendusername") = application("sendusername")
 .item(sch & "sendpassword") = application("sendpassword")
 .update
end with

with CreateObject("CDO.Message")
  .configuration = config
  .to = ...
  .from = ...
  .subject = ....
  .HTMLBody = ....
  call .send()
end with
Joost Moesker
+1 for the code sample
Filburt