473,889 Members | 1,489 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CDO.Message parameter problem

I am trying to send mail from my ASP app using CDO, my
problem is this.

If I use a string in the .To field ie "me@myco.co m" the
page works fine and the mail is sent, if I change the
value to be the result of a recordset the page fails.

I have used a response.write to check the recorset
contains a valid email address, this appears to be fine.

My code is listed below.

Dim iMsg
Dim iConf
Dim Flds
set iMsg = CreateObject("C DO.Message")
set iConf = CreateObject("C DO.Configuratio n")
Const cdoSendUsingPor t = 2
Set Flds = iConf.Fields
With Flds
.Item
("http://schemas.microso ft.com/cdo/configuration/sendusing"
) = cdoSendUsingPor t
.Item
("http://schemas.microso ft.com/cdo/configuration/smtpserver
") = "localhost"
.Item
("http://schemas.microso ft.com/cdo/configuration/smtpconnec
tiontimeout") = 10
.Update
End With

'lookup users email address
set myRecordSet = myUser.getUserE mailAddress(Req uest.form
("cboAssignTo") )
emailto = myRecordSet(0)
emailTitle = "Email Alert"
emailFrom = "al***@iHotdesk .com"
sBody = "Call Description: xxxxxx " & vbcr

With iMsg
Set .Configuration = iConf
.To = emailto
.From = emailFrom
.Subject = emailTitle
.TEXTBody = sBody
.Send
End With

Any help greatfully appreciated.

Thanks
Jul 19 '05 #1
12 6425
> value to be the result of a recordset the page fails.

Could you be a little more specific?

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
Jul 19 '05 #2
"Paul" <pa********@iho tdesk.com> wrote in message
news:08******** *************** *****@phx.gbl.. .
I am trying to send mail from my ASP app using CDO, my
problem is this.

If I use a string in the .To field ie "me@myco.co m" the
page works fine and the mail is sent, if I change the
value to be the result of a recordset the page fails.


Are you sure that the smtp server you are using will relay mail to external
addresses? If it's not configured to relay it may accept mail for a local
domain but reject remote domains.

Tony
Jul 19 '05 #3
Aaron

in the code I perfrom a lookup on the selected users email address
before sending the mail as follows:
----------------------------------------
'lookup users email address
set myRecordSet = myUser.getUserE mailAddress(Req uest.form
("cboAssignTo") )
emailto = myRecordSet(0)
------------------------------------------
This returns the users email address, however if I set the .To field as
follows:

.To = emailto

The page fails, however if I set

.To = "an****@abc.com "

it works. The recordset is poplated with an email address, I have used
response.write to verify the contents.

The wierdest thing though is that I can use the contents as the from
address (.From = emailto) without any problems.

Regards,

Paul


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #4
You still haven't answered the question.
The page fails,


I got that. What on earth does "fails" mean? Do you get an error
message??? If so, don't you think it might be useful to include it?

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
Jul 19 '05 #5
Is it possible there is an extra space coming from the db??

Try checking the length of the string to make sure it is what you expect
Len() and use Trim() to remove any if there are extra.

Long shot I know.

Mike
"Paul" <an*******@disc ussions.microso ft.com> wrote in message
news:0c******** *************** *****@phx.gbl.. .

Tony,

the server is sending mail without any problems, if I set
the contents of the .TO field as follows
.TO = "jo********@abc .com"
it works fine yet if I use
.To = emailto it does not work even though emailto is
pouplated with a valid email address.

I have been doing some other testing and have also found
it works ok for the .From field (.From = emailto) but not
the .To field.



-----Original Message-----
"Paul" <pa********@iho tdesk.com> wrote in message
news:08******* *************** ******@phx.gbl. ..
I am trying to send mail from my ASP app using CDO, my
problem is this.

If I use a string in the .To field ie "me@myco.co m" the
page works fine and the mail is sent, if I change the
value to be the result of a recordset the page fails.


Are you sure that the smtp server you are using will

relay mail to external
addresses? If it's not configured to relay it may accept

mail for a local
domain but reject remote domains.

Tony
.

Jul 19 '05 #6
Thanks Mike,

tried len() and it checks out ok, I've also tried removing leading and
trailing spaces and also tried using cstr() but still no joy.
P


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #7
> still no joy.

Are we on a mission to be as vague as possible?

What do the statements "fails" and "no joy" mean???

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
Jul 19 '05 #8
Aaron,
when the page is working it posts back to itself (i.e. when I set the
.TO = "an****@abc.com ") when it fails all I receive is a HTTP 500 -
Internal server error.

I've chedked the event logs and IIS logs but can;t find anything, I've
also switched debugging on and set the 'Send details ASP error messages
to client' option to ON in IIS but still can;t get any meaningfull
errors.

P

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #9
> when it fails all I receive is a HTTP 500 - Internal server error.

Ah, a light bulb must have gone somewhere! Hooray! Do you see why it's
difficult to proceed when the only description you give is, "it's broken"?

Now, let's find out what the real error is. http://www.aspfaq.com/2109

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
Jul 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3853
by: Dan | last post by:
I've run into an interesting problem, and seemed to have stumped 3 newsgroups and 2 other forums. For some reason when I try to insert a record into a SQL table that has a Text column, the returned autogenerated Identity is wrong (on the VB side). This only occurs if the length of the value inserted for the text column is >= 8002. I've included a simple example below.
3
16952
by: WGW | last post by:
Though I am a novice to MS SQL server (2000 I believe), I can do almost! everything I need. Maybe not efficiently, but usefully. However, I have a problem -- a complex query problem... I can create a parameter query in a stored procedure, but how do I use the result set of a parameter query in a select query (in the same or another sp)? In short, if a select query contains a result table that is generated as a parameter query, how do I...
9
1168
by: Simon | last post by:
Hi everyone, I'm wondering what you're supposed to do when you call a method that is required to perform some action but that action subsequently fails. More specifically, how do you get a custom message back so that you can provide some useful information to the application user? It seems we dont have much room for manouever. Example:
6
1884
by: ndn_24_7 | last post by:
Hello all, I have a stored procedure that prompts the user for beginning date and ending date to run a monthly report. The prompt says Enter_Beginning_Date and Enter_Ending_Date. I want the prompt to say Enter Beginning Date (Example:1-1-2003) or something like that. Is there a way to do this? CREATE PROCEDURE dbo.MonthlyReport(@Enter_Beginning_Date datetime, @Enter_Ending_Date datetime) AS SELECT incident, @Enter_Beginning_Date AS...
4
2739
by: wkaras | last post by:
I would like to propose the following changes to the C++ Standard, the goal of which are to provide an improved ability to specify the constraints on type parameters to templates. Let me say from the start that my knowledge of compiler implementation is very limited. Therefore, my suggestions may have to be rejected because they are difficult or impossible to implement. The proposal is based on the concept of "type similarity". Type...
2
2768
by: Siegfried Weiss | last post by:
Hi guys, i give up finding a solution by reading or by trial & error. Hope, YOU can help me! (Sorry for my rather long posting.) Stroustrup says, that templates could be declared with - type parameter, e.g. template<class T> - parameters with *simple* types like int, e.g. template<int size> - template parameter, e.g. template< template<class> class A > the latter beeing a type specifier, not an instance of A.
1
2540
by: Clark Choi | last post by:
I ran the sample application called Petstore from msdn. Everything went fine until I tested Update button on the web form to update the database through Datagrid. I have been searching the web to track down this error, but none of them really explain this problem/solution very well. I tried hard to debug this, but debuggin itself was impossible. The error message is as follows:
2
14757
by: paul.dunstone | last post by:
HI all I am using msbuild to compile my web application project. After building the solution I get the following error message: Server Error in '/Community' Application. -------------------------------------------------------------------------------- Value cannot be null.
7
2142
by: teddarr | last post by:
I have an assignment I've been working on for a few days now. I need some help with the last detail. The program is supposed to create 5 objects with varying floating-point parameter lists. The class (Rectangle) is supposed to calculate the perimeter and area and tell whether the shape is a square or not. Then put this info in a table and sent to an external file. The limits on the sides of the rectangle is greater than 0.0 and no more...
8
4642
by: DanicaDear | last post by:
I have something interesting...looking to see if anyone else has came across this. I have a query with parameter and and the query works beautifully every time. However, when I use the wizard to build a report, at the end of the wizard the report opens beautifully, asks for the 2 parameters, and displays results. Beautiful. Then, after closing the report and re-opening, the report promts me for a third, unwanted parameter. ...
0
9962
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9810
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11198
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10442
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9609
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5829
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6029
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4647
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3256
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.