Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ASP.NET SMTPsvg.dll

Posted on 2004-10-16
5
Medium Priority
?
1,337 Views
Last Modified: 2013-11-25
Hi guys

Is anyone aware whether or not you can use the Active Server Component ASPMAIL (SMTPsvg.dll) from ASP.NET/VB.NET? This is my webhost's emailing component.

The documentation says I need to use:
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")

I also read that I need to use the page directive: aspcompat="true" if using ASPX rather an ASP. But this gives me the error:

Parser Error Message: The current trust level does not allow use of the 'AspCompat' attribute

My ISP tell me to 'rename the aspx to asp', and that's as much help as they will give. Have tried creating a reference to smtpsvg.dll, but this hasn't solved the problem.

I will do it in ASP if I have to, but would rather keep all code in ASPX.VB (as I'm passing a password for email).

Any help gratefully received!

Thanks.
0
Comment
Question by:dalsandhu
  • 2
5 Comments
 
LVL 15

Assisted Solution

by:Timbo87
Timbo87 earned 200 total points
ID: 12330713
Have you considered using the .NET Framework's built-in mail sending features?

http://www.aspheute.com/english/20000918.asp
http://www.developer.com/net/asp/article.php/3096831
0
 
LVL 17

Accepted Solution

by:
AerosSaga earned 1800 total points
ID: 12333836
do it this way:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
try
Dim objEmailMessage As System.Web.Mail.MailMessage
Dim objSMTPServer As System.Web.Mail.SmtpMail
objSMTPServer.SmtpServer = "mycomputername"
objEmailMessage = New System.Web.Mail.MailMessage
With objEmailMessage
.To = "destinationemail@address.com"
.From = txtFrom.Text
.Subject = "Great Job!"
.Body = "Want all my money?"
.BodyFormat = MailFormat.Html
End With
objSMTPServer.Send(objEmailMessage)
catch exc as exception
response.write(exc.innerexception.innerexception.message)
end try
End Sub
____________________________________________________________________________________________
Or
_____________________________________________________________________________________________

Private Sub Page_Load(sender As Object, e As System.EventArgs)
   Dim mail As New MailMessage()
   mail.To = "me@mycompany.com"
   mail.From = "you@yourcompany.com"
   mail.Subject = "this is a test email."
   mail.BodyFormat = MailFormat.Text
   mail.Body = "Some text goes here"
   mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1") 'basic authentication
   mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "my_username_here") 'set your username here
   mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "super_secret") 'set your password here
   SmtpMail.SmtpServer = "mail.mycompany.com" 'your real server goes here
   SmtpMail.Send(mail)
End Sub 'Page_Load
-------------------------------------------------------------------------------------------------
For ReadReceipt
  .Headers.Add("Return-Receipt-To", "me@mydomain.com")

Why do it the long way with old school equipment???

Aeros
0
 

Author Comment

by:dalsandhu
ID: 12345487
Good point Aeros.
Works a treat - thanks muchly.

Dal
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12346212
Your very welcome my frined; Work smarter, not harder;)

Aeros
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question