Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASPEMAIL

Status
Not open for further replies.

gc1234

Programmer
Mar 4, 2004
94
GB
Hi

Not a dot net person, can anyone please convert this CDONTS syntax to ASPEmail pleasE?

Set mail = Server.CreateObject ("CDONTS.NewMail")

mail.BodyFormat = 1
mail.MailFormat = 0

on error resume next

mail.Send from, rcpt, subject, body
 
Hi there!
I presume that you are trying to use ASPEmail with ASP.NET WebApplication. In this case, here's the solution:
Code:
IMailSender oMail = new MailSenderClass();
oMail.Host = "localhost"; //SMTP server
oMail.Port = 25; //SMTP port
oMail.AddAddress("address1@domain.com",""); //Mail To:
oMail.From = "your@address.com"; //Mail From:
oMail.FromName = "My Name";
oMail.Subject = "some subject";
oMail.Body = "some message"; //Message Body
oMail.IsHTML = 1; //0 if you want to send mail as Text
//oMail.Queue = 1; //in case you can&want to use queue
try
{
	oMail.Send("");
}
catch(Exception Ex)
{
	Response.Write("Error: "+Ex.Message+"<br>");
}
finally
{
	oMail=null;
}
Note that you must add a reference to ASPEMAILLib.dll (which you'll find inside your ASPEmail installation folder/bin folder)

Anyway, in case you didn't knew, in ASP.NET there's an object that helps sending emails - MailMessage (namespace: System.Web.Mail)

Hope this helps!

[morning]
 
I've been told to use ASPEmail or something compatable to 2003 server is this code ok>?

if pEmailComponent="PersitsASPMail" then

set mail = server.CreateObject("Persits.MailSender")

' change with your smtp server

mail.Host = pSmtpServer
mail.From = from
mail.FromName = fromName
mail.AddAddress rcpt
mail.AddReplyTo from
mail.Subject = subject
mail.Body = body

on error resume next

mail.Send

end if
 
gc1234,

Did you get you get this aspemail code to work?

If so, can you post it.

Thanks,

DH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top