Aspmail

Saludos Expertos:
Tengo el siguiente código que me envía mails a través de asp con CDONTS y en el servidor que tengo alojada la Web solo permite USAR ASPMAIL.
Podríais indicarme que tengo que modificar para que funcione con ASPMAIL.
Gracias..
Set objNewMail = Server.CreateObject("CDONTS.NewMail")
objNewMail.From = "orders@your_address.com"
objNewMail.To = email
objNewMail.Subject = "Your order from your_address.com"
strBody = "Dear "&firstname&","&Vbcrlf&Vbcrlf
strBody=strBody&"Thank you for placing your order with your_address.com. We will process it as soon as possible." & vbcrlf& vbcrlf
strBody=strBody&"Items in stock will be delivered the next working day. We aim to deliver all orders within 7 working days." & vbcrlf& vbcrlf
strBody=strBody&"We will email when your order is about to be delivered." & vbcrlf & vbcrlf
strBody=strBody& "If you have any questions about your order, please the use the following contact details. "& vbcrlf& vbcrlf
strBody=strBody&" Your order reference is : x000-"&order_id&"-111"&vbcrlf&Vbcrlf
strBody=strBody& " your_address "& vbcrlf
strBody=strBody& " your_address " & vbcrlf
strBody=strBody& " your_address " & vbcrlf
strBody=strBody& " your_address " & vbcrlf
strBody=strBody& " your_address " & vbcrlf & vbcrlf
strBody=strBody& "Phone: your_phone" & vbcrlf
strBody=strBody& "Fax: your fax " & vbcrlf
strBody=strBody& "Email: your email" & vbcrlf & vbcrlf
strBody=strBody&"__________________________________________"&vbcrlf&Vbcrlf
strBody=strBody&"your_address.com"&vbcrlf
strBody=strBody&"http://www.your_address.com/"
objNewMail.Body=strBody
objNewMail.Send
Set objNewMail = Nothing
end if
Response.Redirect "thanks.asp"
%><!-- #include file="inc/cleanupinc.asp" -->

1 Respuesta

Respuesta
1
Básicamente tenés que invocar o mejor dicho, crear el objeto de otra manera y las propiedades son distintas, te mando el código con aspemail; te muestro donde poner el destinatario, remitente, asunto, mensaje, etc. Vos ponelo después.
Set ObjNewMail = Server.CreateObject ("SMTPsvg.Mailer")
propiedades basicas...
ObjNewMail.FromName = "Nombre del remitente"
ObjNewMail.FromAddress = "[email protected]"
ObjNewMail.Subject = "Asunto del mail que enviamos"
ObjNewMail.BodyText = "Cuerpo o mensaje del mail"
ObjNewMail. AddRecipient "Mario"
ObjNewMail. AddRecipient "Juan"
ObjNewMail. AddBCC "Pedro"
ObjNewMail.RemoteHost = "localhost"
ObjNewMail. SendMail
Ponelo así que va a funcionar.
Antentamente. Manuel Fernández.
He modificado el codigo y no me funciona haber si me puedes corregir este codigo.Te lo agradeceria un monton.
Gracias.
if send_emails=true then
Set ObjNewMail = Server.CreateObject ("SMTPsvg.Mailer")
ObjNewMail.FromName = "www.pc21.es"
ObjNewMail.FromAddress = "[email protected]"
ObjNewMail.Subject = "Confirmacion pedido"
ObjNewMail.BodyText = "Cuerpo o mensaje del mail"
ObjNewMail.AddRecipient "Mario"
ObjNewMail.AddRecipient "Juan"
ObjNewMail.AddBCC "Pedro"
ObjNewMail.RemoteHost = "smtp.pc21.es"
ObjNewMail.SendMail
strBody = "WEB SITE ORDER,"&Vbcrlf&Vbcrlf
strBody=strBody&"__________________________________________"&vbcrlf&Vbcrlf
sql="select * from basket_products a, products b, orders d " & _
"where a.product_id=b.product_id " & _
" and d.basket_id=a.basket_id " &_
" and a.basket_id="&basket_id
set objrs=objconn.execute(sql)
if objrs.eof then
Response.Write "Error"
esponse.end
end if
while not objrs.eof
strBody=strBody&objrs("product_name")&" £"&objrs("product_price")&" ("&objrs("catalogue_id")&") " & objrs("publisher_name")&vbcrlf
order_id=objrs("order_id")
objrs.movenext
wend
select case(cardtype)
case 0:
cardtype="Visa"
case 1:
cardtype="Master Card"
case 1:
cardtype="American Express"
end select
strBody=strBody&"Total : £"&formatnumber(total,2)&vbcrlf
strBody=strBody&"First Name : " & firstname & vbcrlf
strBody=strBody&"Email : " & email & vbcrlf
strBody=strBody&"Surname : " & surname & vbcrlf
strBody=strBody&"Address1 : " & address1 & vbcrlf
strBody=strBody&"Address2 : " & Address2 & vbcrlf
strBody=strBody&"City: " & city & vbcrlf
strBody=strBody&"County : " & county & vbcrlf
strBody=strBody&"Country : " & country & vbcrlf
strBody=strBody&"postcode : " & postcode & vbcrlf
strBody=strBody&"phone : " & phone & vbcrlf
strBody=strBody&"Email : " & email & vbcrlf
strBody=strBody&"__________________________________________"&vbcrlf&Vbcrlf
strBody=strBody&"cardtype : " & cardtype & vbcrlf
strBody=strBody&"card Number : " & cardnum & vbcrlf
strBody=strBody&"card expirey : " & cardmonth&"\"&cardyear & vbcrlf
strBody=strBody&"__________________________________________"&vbcrlf&Vbcrlf
strBody=strBody&"Shipping First Name : " & sfirstname & vbcrlf
strBody=strBody&"Shipping Surname : " & ssurname & vbcrlf
strBody=strBody&"Shipping Address1 : " & saddress1 & vbcrlf
strBody=strBody&"Shipping Address2 : " & sAddress2 & vbcrlf
strBody=strBody&"Shipping City: " & scity & vbcrlf
strBody=strBody&"Shipping County : " & scounty & vbcrlf
strBody=strBody&"Shipping Country : " & scountry & vbcrlf
strBody=strBody&"Shipping postcode : " & spostcode & vbcrlf
strBody=strBody&"__________________________________________"&vbcrlf&Vbcrlf
strBody=strBody&"Order Reference : x000-"&order_id&"-000"&vbcrlf&Vbcrlf
strBody=strBody&"your_address.com"&vbcrlf
strBody=strBody&"http://www.your_address.com"
objNewMail.Body=strBody
ObjNewMail.SendMail
Set objNewMail = Nothing
Set ObjNewMail = Server.CreateObject ("SMTPsvg.Mailer")
ObjNewMail.FromName = "www.pc21.es"
ObjNewMail.FromAddress = "[email protected]"
ObjNewMail.Subject = "Confirmacion pedido"
ObjNewMail.ToAddress = "[email protected]"
strBody = "Dear "&firstname&","&Vbcrlf&Vbcrlf
strBody=strBody&"Thank you for placing your order with your_address.com. We will process it as soon as possible." & vbcrlf& vbcrlf
strBody=strBody&"Items in stock will be delivered the next working day. We aim to deliver all orders within 7 working days." & vbcrlf& vbcrlf
strBody=strBody&"We will email when your order is about to be delivered." & vbcrlf & vbcrlf
strBody=strBody& "If you have any questions about your order, please the use the following contact details. "& vbcrlf& vbcrlf
strBody=strBody&" Your order reference is : x000-"&order_id&"-111"&vbcrlf&Vbcrlf
strBody=strBody& " your_address "& vbcrlf
strBody=strBody& " your_address " & vbcrlf
strBody=strBody& " your_address " & vbcrlf
strBody=strBody& " your_address " & vbcrlf
strBody=strBody& " your_address " & vbcrlf & vbcrlf
strBody=strBody& "Phone: your_phone" & vbcrlf
strBody=strBody& "Fax: your fax " & vbcrlf
strBody=strBody& "Email: your email" & vbcrlf & vbcrlf
strBody=strBody&"__________________________________________"&vbcrlf&Vbcrlf
strBody=strBody&"your_address.com"&vbcrlf
strBody=strBody&"http://www.your_address.com"
objNewMail.Body=strBody
ObjNewMail.SendMail
Set objNewMail = Nothing
end if
Response.Redirect "thanks.asp"
Probá con el siguiente código, este debería funcionar:
Dim Mail
On Error Resume Next
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "mail.tuservidor.com"
Mail.ContentTransferEncoding = "Quoted-Printable"
Mail.From = From
Mail.FromName = Mail.EncodeHeader(FromName)
Mail.AddAddress Address, Mail.EncodeHeader(AddressName)
Mail.Subject = Mail.EncodeHeader(Subject)
Mail.Body = Body
Mail.SendToQueue
If Err <> 0 Then
Correo = Err.Description
Else
Correo = ""
End If
Atentamente. Manuel Fernandez.
PD: Perdón por la demora.

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas