Solved

error in sending email at  myMail.Send

Posted on 2009-04-03
16
499 Views
Last Modified: 2012-06-21
error is coming at line no. 7         myMail.Send

CDO.Message.1 error '80040220'
The "SendUsing" configuration value is invalid.
/projects/projects/send_mail_asp/2/test.asp, line 7

can u tell me how i can make it right?



<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="mymail@mydomain.com"
myMail.To="someone@somedomain.com"
myMail.TextBody="This is a message."
myMail.Send
set myMail=nothing
%>

Open in new window

0
Comment
Question by:designersx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 7
  • 2
16 Comments
 
LVL 23

Expert Comment

by:apresto
ID: 24059731
The reason i posted this link, is because your script would work if amended by you want to specify configuration settings, that thread has a very good example
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24065945
can you please post all the code for your mail?
Nothing else, just the code for the mail.
This way we can see what you have and what you Do Not Have.

Also.
If you are sending mail To: someone@theirdomain.com
Then you might have to set up a relay.

Post your code and we will go from there.

Carrzkiss
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:designersx
ID: 24066005
yes sir, i am sending you the files for that. please see that.
mail is sent properly, the problem is suppose when u come to the site and registers and enters your email id then your email id is not send to the email id , this is because there was given static email id in the from variable.

we just have to pick the value of email from the textbox and then store in the variable, if we are able to do this then everything will be fine.

firstly, i am sending u the original code as given by the client. as u can see here in contactus.asp file the problem is in this line of code    [sFromEmail = "admin@frys.com.au"]     that is given static,  we have to pick the value from the textbox and store it in variable sFromEmail  .


in the second post, i will give u the code that i have modified.

regards
yogesh
[contactus.html]
<form name="frm" method="post" action="contactus.asp">
<input name="Email" type="text" class="Utxt1" size="40">
<input name="Submit" type="submit" class="Utxt1" id="Submit" value="Submit">
</form>
 
[contactus.asp]
 
<!-- #INCLUDE FILE="common.asp" -->
<%
	Dim errMsgs
	errMsgs = ""
	OpenDataConnection
	
	IF GetParam("submitted") = "true" THEN
		sName = GetParam("Name")
		sEmail = GetParam("Email")
		sPhone = GetParam("Phone")
		iBranchID = GetParam("branch")
		sWhenyns = GetParam("whenyns")
		sHowmuch = GetParam("howmuch")
		sEnquiry = GetParam("Enquiry")
		
		strEmailTemplate = Server.MapPath("secure\templates\email-contactus.html")
		
		ReadFile strEmailTemplate, sContent
		sContent = Replace(sContent, "{{name}}", TRIM(sName))
		sContent = Replace(sContent, "{{email}}", TRIM(sEmail))
		sContent = Replace(sContent, "{{phone}}", TRIM(sPhone))
		sContent = Replace(sContent, "{{branch}}", getBranchName(iBranchID))
		sContent = Replace(sContent, "{{whenyns}}", TRIM(swhenyns))
		sContent = Replace(sContent, "{{howmuch}}", TRIM(sHowmuch))
		sContent = Replace(sContent, "{{enquiry}}", TRIM(sEnquiry))
		sContent = Replace(sContent, "{{ipaddress}}", Request.ServerVariables("REMOTE_HOST"))
		
		sFromName = "Fry's Self Storage Admin"
		sFromEmail = "admin@frys.com.au"
		sSubject = "Fry's Self Storage Enquiry"
		sTo = getBranchEmail(iBranchID)
	
		SendEmail sFromName, sFromEmail, sTo,"", sSubject, sContent
	ELSE
		Response.Redirect "contactus.html"		
	END IF
	CloseDataConnection
%>
 
[common.asp]
 
// this is the mail function.
Sub SendEmail(pFromName, pFromEmail, pTo, pReplyTo, pSubject, pBody)
	pBody = Replace(pBody, "{{constNonSecureURL}}", constNonSecureURL)
	pBody = Replace(pBody, "{{constSecureURL}}", constSecureURL)
	dim oMailer
	SELECT CASE constEmailObject
		CASE "ASPMAIL"
			Set oMailer = Server.CreateObject("SMTPsvg.Mailer")
			oMailer.FromName = pFromName
			oMailer.FromAddress = pFromEmail
			oMailer.RemoteHost = Application("auctionmailserver")
			oMailer.AddRecipient  pTo, pTo
			oMailer.Subject = pSubject
			oMailer.BodyText = pBody
			oMailer.SendMail
			set oMailer = Nothing
 
		CASE "ASPEMAIL"
			Set oMailer = Server.CreateObject("Persits.MailSender")
			oMailer.FromName = pFromName
			oMailer.From = pFromEmail
			oMailer.Host = "localhost"
			oMailer.Username = ""
			oMailer.Password = ""
			oMailer.AddAddress pTo, pTo
			oMailer.AddCC "k.s.vilkhu@gmail.com"
			'oMailer.AddCC "wesleyfry@frys.com.au"
			IF LEN(pRelyTo) > 0 THEN oMailer.AddReplyTo pReplyTo
			oMailer.Subject = pSubject
			oMailer.Body = pBody
			oMailer.IsHTML = True
			oMailer.Send
			set oMailer = Nothing
	END SELECT
End Sub
 
 
// get param function
 
function GetParam(ParamName)
  if Request.QueryString(ParamName).Count > 0 then
    Param = Request.QueryString(ParamName)
  elseif Request.Form(ParamName).Count > 0 then
    Param = Request.Form(ParamName)
  else
    Param = ""
  end if
  if Param = "" then
    GetParam = Empty
  else
    GetParam = Param
  end if
end function

Open in new window

0
 

Author Comment

by:designersx
ID: 24066013
now i am sending u what i modified.

common.asp file is exactly same.
contactus.asp file is also same but the change that i have made is.

i changed
sFromEmail = "admin@frys.com.au"   (when we write this, mail is sent, no problem comes but it is static)
to
sFromEmail = "sEmail"   (problem is coming here.)

that's it.

and the problem is coming. i think we should not use  request.querystring because if u see in the getparam function, request.querystring is already used.

yogesh.
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24066101
For apresto:
If you are wondering what he is referring to, please look at his other post.
http:Q_24287573.html

Carrzkiss

(I will have a look at it now)
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24066148
designersx:

I do not understand your code.
You have so much going on, and yet this code has nothing to do with this error.

I do not see nothing in this code that shows:

<%
Set myMail=CreateObject("CDO.Message")
%>

Where is it at?

Also.
If you are getting an error from
>>   sFromEmail = "sEmail"   (problem is coming here.)
Then you need to look at your code better.
I checked out the function for it,
Request.Form(ParamName)

I think that is where your issue it.
It has been years since I have used code like this.
And I do not remember, and would have to read up on it again, and I just do not have the time
Right now to do so.

The below code demostrates how to use the CDOSYS component.
myMail.From = Request.Form("Email")
This will work every time.

You may need to replain your code.
Unless [apresto] (or) someone else comes in that is familuar with your Param's

Sorry, but right now, this is about all that I can do for you.
It is basic and easy if it is done as coded below.

Carrzkiss


 
<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From = Request.Form("Email")
myMail.To="someone@somedomain.com"
myMail.TextBody="This is a message."
myMail.Send
set myMail=nothing
%>

Open in new window

0
 

Author Comment

by:designersx
ID: 24066151
respected Sir,

the post which apresto has reffered me is to deal with sending mail using ASP build in objects but i don't want to get into that, it will furthur because my email is being sent properly there is only a little problem as i have explained u earlier in my above post.

please check the above code and tell me the change i have done is wrong or not comparing the original code. i have send u both original and modified code.

yogesh
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24066171
you need to find a way to do this

myMail.From = Request.Form("Email")
with this
sEmail = GetParam("Email")

Should be
sEmail = request.form("Email")

Once you find that way, then you are good to go.
I am unable to assist further, I do not know this code.
I can only give you what I have to give, and that is simplicity.
If you look at what I just wrote "coded" above, you will see how it works.
It does the same thing that your
sEmail = GetParam("Email")
Does, but that is NOT working for you.
This is what I WOULD do. (Code below)

This I think would work better for you.
You just need to find a way to make it work in your design.
remove the Param, and try this.
If it does not work for you, then you may need to think of a redesign.

I am sorry, this is absolutely All that I have to give to you.
I wish that I could do more, but I have not done Param's in many many years.
And DO NOT have the time to do it now.

Sorry.
Carrzkiss

		sName = request.form("Name")
		sEmail = request.form("Email")
		sPhone = request.form("Phone")
		iBranchID = request.form("branch")
		sWhenyns = request.form("whenyns")
		sHowmuch = Grequest.form("howmuch")
		sEnquiry = request.form("Enquiry")

Open in new window

0
 

Author Comment

by:designersx
ID: 24066172
sir please leave/forget my question and see my 1st and 2nd comment.  please (apologize from my side )   getting all the things messed up. the reason is actually my boss told me to implement the basic code of sending mail with asp when i was unable to solve the problem, that's why i started doing that. now fthat and focussing only on my post totally forgetting everything. i heartly request u to see only my 1st and 2nd comment.

u r exactly right it has nothing to do with this code. sFromEmail = "sEmail"

// forget all about  this code, and see my 1st and 2nd code
<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From = Request.Form("Email")
myMail.To="someone@somedomain.com"
myMail.TextBody="This is a message."
myMail.Send
set myMail=nothing
%>
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24066173
sName = request.form("Name")
sEmail = request.form("Email")
sPhone = request.form("Phone")
iBranchID = request.form("branch")
sWhenyns = request.form("whenyns")
sHowmuch = request.form("howmuch")   ' <-- corrected this line
sEnquiry = request.form("Enquiry")
0
 
LVL 31

Accepted Solution

by:
Wayne Barron earned 50 total points
ID: 24066212
fine, you want me to forget about that code.
That is great.
DO THIS!

sName = request.form("Name")
sEmail = request.form("Email")
sPhone = request.form("Phone")
iBranchID = request.form("branch")
sWhenyns = request.form("whenyns")
sHowmuch = request.form("howmuch")  
sEnquiry = request.form("Enquiry")

Listen to the boss.
An easy mail function is easy to do, and can be made up in about 5 minutes or less.
To work with your system.
But you have choosen the hard path, and not many people are going to be able to assist you on it.
Especially since it is the weekend.

I am off here for the night.
it is 2:45am
Time for sleep.

Carrzkiss
0
 

Author Comment

by:designersx
ID: 24066261
r u from uk?
0
 

Author Comment

by:designersx
ID: 24066321
able to solve the prob.


thanks for ur assistance.
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24067513
from the US
Did you solve the issue? Or are you asking me if I did?

I am going to be away from the computer from nearly the entire day.
Need a break.

have a good one.
Carrzkiss
0
 

Author Comment

by:designersx
ID: 24067617
i have solve the issue, there was some trick i applied and the issue was solved  but really thanks for ur help that u gave me.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question