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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I send e-mails ?

Status
Not open for further replies.

Lissinho

Programmer
May 3, 2001
10
BR
Hi,

I'm a new ASP programmer, and I have a simple question:
"How can I send e-mail using ASP ?"

My server has NT 4, IIS 4 and Exchange Server 5.5 installed.
I've tried MAPI.Session and CDONTS.NewMail, but both didn't work.

MAPI.Session code:
1 Set oCDO = CreateObject("MAPI.Session")
2 oCDO.Logon , , , , , , "SYSPLAN01" & vbLf & "Administrador"

3 Set oPasta = oCDO.Outbox
4 Set oMensagens = oPasta.Messages

5 Set oMsg = oMensagens.Add
6 oMsg.Subject = "Teste - " + Request.Form("Sistema")
7 cTexto = "Text1: " + Request.Form("Text1") & vbCrLf
8 cTexto = cTexto + "E-mail: " + Request.Form("E-mail")
9 oMsg.Text = cTexto

10 Set oRcpt = oMsg.Recipients
11 oRcpt.Add , "SMTP:email@server.com.br"
12 oRcpt.Resolve

13 oMsg.Send False

14 oCDO.Logoff

MAPI.Session error:
Collaboration Data Objects erro '0000505'
You do not have permission to log on. [Microsoft Exchange Server Information Store - [MAPI_E_FAILONEPROVIDER(8004011D)]]
line: 4

CDONTS.NewMail code:
1 set oMsg = CreateObject("CDONTS.NewMail")

2 oMsg.From = Request.Form("E-mail")
3 oMsg.To = "email@server.com.br"

4 oMsg.Subject = "Teste - " + Request.Form("Sistema")

5 cTexto = "Text1: " + Request.Form("Text1") & vbCrLf
6 cTexto = cTexto + "Email: " + Request.Form("E-mail")
7 oMsg.Body = cTexto

8 oMsg.Importance = 1

9 oMsg.Send()

10 set oMsg = nothing

CDONTS.NewMail error:
error '80070003'
The system could not find the specified path.
line 9


Thanks a lot

 
Hi,
I haven't used MAPI.session.
Try this with CDONTS

dim cTexto

1 set oMsg = CreateObject("CDONTS.NewMail")

2 oMsg.From = Request.Form("E-mail")
3 oMsg.To = "email@server.com.br"

4 oMsg.Subject = "Teste - " & Request.Form("Sistema")
5 cTexto = "Text1: " & Request.Form("Text1") & vbCrLf
6 cTexto = cTexto & "Email: " & Request.Form("E-mail")
7 oMsg.Body = cTexto

8 oMsg.Importance = 1

9 oMsg.Send()

10 set oMsg = nothing

Hope this works for you


GH
 
Thanks GH !

But it doesn't work either. It returns the same error.

It's funny: the error is in the line of the method "send". All the address exists (not in the example I inserted in this forum).

Thanks one more time...

 
You may want to check out Persits' email component.

It's free, and allows you to specify which mail server you want to use -- very easy to set up and comes with full instructions --

You can find it at
good luck! :)
Paul Prewett
 
I forget too -- Do you check the SMTP if it is up running?
The domain should be yourservername.yourdomainname.com

Hope this helps
GH
 
I forgot too -- Do you check the SMTP if it is up running?
The domain should be yourservername.yourdomainname.com

Hope this helps
GH
 
Hi just check if that component is present on the server
i belive that that is not available for your use

there is a gr8 article in learnasp.com to find which all components are installed on the server

Regards Unicorn11
unicorn11@mailcity.com

[red]Luck is not chance, it's toil; fortune's expensive
smile is earned.[red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top