Solved

ASP.NET SMTPsvg.dll

Posted on 2004-10-16
5
1,306 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 50 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 450 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

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

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…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

624 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