Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: send mail with asp


Message #1 by acaterino@i... on Thu, 19 Apr 2001 12:16:34
I used  mapi session and asp code to send e-mail from a web page and it 

works fine only if I logged on the pc which is running iis .IIS server is 

windows 2000 server.The exchange server is not the same as the iis one and 

is a winnt server.

the lan's PDC is a winnt server.

If I log on a pc in lan with the same account and try send a message from 

the same page i receive the error 



[MAPI 1.0 - [MAPI_E_LOGON_FAILED(80040111)]]









this is the code, could you tell me if you know how i can solve the 

problem ?





Set objSession=CreateObject("MAPI.Session")



StrServer="server_name"

StrMailbox ="exchange account" ' is the windows user's exchange account 

'that is found in a database by code 



strProfileInfo = StrServer & vblf & StrMailbox

'strProfileInfo = "server_name" &vbLf & "exchange account"

objSession.Logon "", "", False, True, 0, True, _

                 strProfileInfo

strRecipient ="Recipient" 'is the recipient's exchange account 

'that is found in a database by code 



Set objOutbox=objSession.Outbox

Set objMessage=ObjOutbox.Messages.Add

objMessage.subject="subject"

objMessage.text="text"

Set objRecipient = objMessage.Recipients.Add

objRecipient.Name = strRecipient

objRecipient.Resolve

ObjMessage.send



Message #2 by "TomMallard" <mallard@s...> on Thu, 19 Apr 2001 05:20:09 -0700
Sounds like your IIS machine needs a user account, IUSR_xxxx, with the

exchange machine.



tom

----- Original Message -----

From: <acaterino@i...>

To: "ASP Web HowTo" <asp_web_howto@p...>

Sent: Thursday, April 19, 2001 4:42 AM

Subject: [asp_web_howto] send mail with asp





> I used  mapi session and asp code to send e-mail from a web page and it

> works fine only if I logged on the pc which is running iis .IIS server is

> windows 2000 server.The exchange server is not the same as the iis one and

> is a winnt server.

> the lan's PDC is a winnt server.

> If I log on a pc in lan with the same account and try send a message from

> the same page i receive the error

>

> [MAPI 1.0 - [MAPI_E_LOGON_FAILED(80040111)]]

>

>

>

>

> this is the code, could you tell me if you know how i can solve the

> problem ?

>

>

> Set objSession=CreateObject("MAPI.Session")

>

> StrServer="server_name"

> StrMailbox ="exchange account" ' is the windows user's exchange account

> 'that is found in a database by code

>

> strProfileInfo = StrServer & vblf & StrMailbox

> 'strProfileInfo = "server_name" &vbLf & "exchange account"

> objSession.Logon "", "", False, True, 0, True, _

>                  strProfileInfo

> strRecipient ="Recipient" 'is the recipient's exchange account

> 'that is found in a database by code

>

> Set objOutbox=objSession.Outbox

> Set objMessage=ObjOutbox.Messages.Add

> objMessage.subject="subject"

> objMessage.text="text"

> Set objRecipient = objMessage.Recipients.Add

> objRecipient.Name = strRecipient

> objRecipient.Resolve

> ObjMessage.send

Message #3 by "Alex Shiell, ITS, EC, SE" <alex.shiell@s...> on Thu, 19 Apr 2001 12:55:21 +0100
this is a security problem/feature with running IIS and Exchange on seperate

machines.  You need to enable Basic Authentication on the site to get round

it.



If you actually have IIS installed on the exchange box as well, then another

option would be to put the ASPs which interact with exchange on the exchange

box.



However if all you're doing is creating and sending messages, just use

CDONTS, and don't bother with exchange at all.



(BTW, my experience is with NT4, IIS4 and Exchange 5.5 - the above might not

be true for 2000 versions)



-----Original Message-----

From: acaterino@i...

[mailto:acaterino@i...]

Sent: Thursday, April 19, 2001 12:43 PM

To: ASP Web HowTo

Subject: [asp_web_howto] send mail with asp





I used  mapi session and asp code to send e-mail from a web page and it 

works fine only if I logged on the pc which is running iis .IIS server is 

windows 2000 server.The exchange server is not the same as the iis one and 

is a winnt server.

the lan's PDC is a winnt server.

If I log on a pc in lan with the same account and try send a message from 

the same page i receive the error 



[MAPI 1.0 - [MAPI_E_LOGON_FAILED(80040111)]]









this is the code, could you tell me if you know how i can solve the 

problem ?





Set objSession=CreateObject("MAPI.Session")



StrServer="server_name"

StrMailbox ="exchange account" ' is the windows user's exchange account 

'that is found in a database by code 



strProfileInfo = StrServer & vblf & StrMailbox

'strProfileInfo = "server_name" &vbLf & "exchange account"

objSession.Logon "", "", False, True, 0, True, _

                 strProfileInfo

strRecipient ="Recipient" 'is the recipient's exchange account 

'that is found in a database by code 



Set objOutbox=objSession.Outbox

Set objMessage=ObjOutbox.Messages.Add

objMessage.subject="subject"

objMessage.text="text"

Set objRecipient = objMessage.Recipients.Add

objRecipient.Name = strRecipient

objRecipient.Resolve

ObjMessage.send






  Return to Index