Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ASP.NET SMTPsvg.dll

Posted on 2004-10-16
5
Medium Priority
?
1,324 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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…

721 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