PDA

Click to See Complete Forum and Search --> : "send email through web"- problem


lirlir
Aug 10th, 2000, 02:19 AM
i m trying to send an email through a web site like this:

function btnsend_onclick() {
if (document.frmreply.txt.value=="")
alert ("not good");
else
window.location.href="mailto:liron.leybovich@ness.com?subject=" + document.frmreply.txt.value ;
}

the problem is that when the outlook opens it puting the next line on the "To" field :

liron.leybovich@ness.com?subject=the text

and than when i m trying to send it doesnt send the mail
cause there is no such email address "liron.leybovich@ness.com?subject=the text"

how can i fix that so it would work ?

tnx lirlir

Aug 10th, 2000, 04:21 AM
<form action="mailto:matthew@ralston.net">
<input name="field1">
<input name="field2">
</form>


You may be able to use a hidden input field called "subject" (for the subject of the email), but I'm not sure.

lirlir
Aug 10th, 2000, 04:34 AM
it ait working it can send the mail cause the address is
not right. somthing@blabla.com?field=text
the right address is somthing@blabla.com

so i can i add the field text ?

Aug 10th, 2000, 05:25 PM
Submitting a form via email is a really dodgy way to go anyway. Many users do not have their email clients setup correctly and sometimes the browser thinks the correct email client is different to the one that the person would normally use.

I suggest you get yourself on a web site host that supports scripting and submit your form to a server script which can send the email. It's much more reliable an professional looking that way. :)

lirlir
Aug 13th, 2000, 12:53 AM
tnx mate,

but can u give me an eg. ?
my site is on ewebcity.com do they supports scripting...?

tnx again
lirlir

lirlir
Aug 13th, 2000, 02:09 AM
hi ,
i want to specify my problem :
i built a site that a user can send a greeting card through it. i want to send an email by clicking a button,
the problem is that when i am clicking the button the
outlook opens ,i want the email (subject AND context) to be sent auto. without
the outlook to open can it be done ? HOW ?

tnx for your help
lirlir

Aug 13th, 2000, 04:38 AM
Yes...eWebCity supports ASP. That makes it very easy.

Tell me all the fields the user is going to fill in on your form and how you'd like them presented in the email and I'll knock up a quick script for you. :)

lirlir
Aug 13th, 2000, 04:43 AM
tnx,tnx,tnx mate
it will b very helpfull,

<form method=post action="mailto:Liron.Leybovich@Ness.com" name="frmreply" enctype="text/plain">
<input type="hidden" name="subject" value="Sent from Liron Leybovich Site">
<table>
<tr><td colspan="5"><textarea NAME="txt" ROWS="6" cOLS="50" > </textarea></td></tr>
</table>

that is it just 1 field

Aug 13th, 2000, 06:02 PM
'k. Shall do that tomorra (tis 23:54 here!! :D ) and post it for ya. :)

lirlir
Aug 14th, 2000, 01:28 AM
okay ,tnx

lirlir
Aug 14th, 2000, 03:01 AM
well mate ,
i found this code that u wrote back in the old days...

objMailer = Server.CreateObject("CDONTS.Newmail") ' Reference the Mailer object variable to an instance of "CDONTS.Newmail"
objMailer.To = "lironl@compro.co.il" 'Fillin the to email address...
objMailer.From = "lironl.compro.co.il"' ...the from email address...
objMailer.Subject = "Email Subject" ' ...the subject...
objMailer.BodyFormat = 0 '... and prepair to send it as
objMailer.MailFormat = 0 ' HTML formatted email
objMailer.Body = "Sample email message." 'The message to send
'Send the email and dismiss the mailer object
objMailer.Send
Set objMailer = Nothing

but i dont know how to put it in an ASP page with the txt field and the "TO" field.

can u pls explain it to me (code will b good).

tnx lirlir

Aug 14th, 2000, 03:44 AM
Ok...here we go...

Place this code (for the form) on your page:
<form method=post action="sendmail.asp">
<input type="hidden" name="subject" value="Sent from Liron Leybovich Site">
<textarea name="txt" rows="6" cols="50"></textarea>
<input type="submit" value="Send">
</form>

Save this code as "sendmail.asp" in the same folder as the page containing your form:
<%@ language=VBScript %>
<%

' Declare a CDONTS mail component to send emails
Dim objMailer

' Reference the Mailer object variable to an instance of "CDONTS.Newmail"
Set objMailer = Server.CreateObject("CDONTS.Newmail")

' Construct the email
objMailer.To = "Liron.Leybovich@Ness.com" 'Fillin the TO email address...
objMailer.From = "Your Website" ' ...the FROM email address...
objMailer.Subject = Request("subject") ' ...the subject...
objMailer.BodyFormat = 1 ' 0=HTML, 1=Plain Text
objMailer.MailFormat = 1 ' 0=HTML, 1=Plain Text
objMailer.Body = Request("txt")

' Send the email and dismiss the mailer object
objMailer.Send
Set objMailer = Nothing

' Send confirmation to user %>
<html>
<head>
<title>Thank you</title>
</head>
<body>
<h3>Thank you.</h3>
I shall review your comments.
</body>
</html>

I haven't had chance to test it :(, so let me know if it doesn't work...(but it should!! :D )

lirlir
Aug 14th, 2000, 04:07 AM
well sorry mate

but it ait working u can c 4 your self on:
http://www10.ewebcity.com/lirlir/classwork/index.htm
u wouldn't understand the language but u dont have to
just click the last button on the right.
that is the sending reply page

after writing something in the textarea click the button
on that page it should lead u to the "sendmail.asp"
but it aint.
do u have any idea way is that ?

tnx any way,
lirlir

lirlir
Aug 14th, 2000, 04:40 AM
hey mates,

i found what is the problem,
eWebCity has the ASPMail object by ServerObjects installed.
the thing is i dont know how to use this object.
does any one know ?

pls help me
lirlir

Ianpbaker
Aug 14th, 2000, 04:59 AM
Hi Lilir

The code for using the aspMail object is as follows


<%
' ASPMail(tm) from http://www.serverobjects.com
' is not part of ASP per se,
' but a third party utility from serverobjects.com
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.RemoteHost = "mail.innerhost.com"

Mailer.FromName = "Some Student"
Mailer.FromAddress = "somestudent@activeserverpages.com"
Mailer.AddRecipient "Charles Carroll","cc@thebestweb.com"
Mailer.AddBCC "Charles Carroll","charles@activeserverpages.com"
Mailer.Subject = "ASPMail Tutorial"

Mailer.BodyText = "Hi. Just trying the mail example" & vbCrLf
Mailer.BodyText = "Line 2"
Mailer.BodyText = "Line 3"
If Mailer.SendMail then
Msg = "mail sent sucessfully!"
Else
Msg = "mail <b>not</b> sent sucessfully"
msg = msg & "<br>" & mailer.response
End If
response.write Msg

set mailer=nothing
%>

If you need some definitions of each method check here

http://www.rapidsite.fr/nt/aspmail_methods.html

Hope this helps

Ian

lirlir
Aug 14th, 2000, 05:48 AM
well i tryed your code Ian but no luck .
i got this msg:

Server object error 'ASP 0177 : 800401f3'

Server.CreateObject Failed

/lirlir/classwork/sendmail.asp, line 3

Invalid ProgID. For additional information specific to this message please visit the Microsoft Online Support site located at: http://www.microsoft.com/contentredirect.asp.

i changed your code to look like this:
<%@ Language=VBScript %>
<%
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.RemoteHost = "mail.innerhost.com"

Mailer.FromName = "lirlir"
Mailer.FromAddress = "liron.leybovich@Ness.com"
Mailer.Subject = "ASPMail Tutorial"

Mailer.BodyText = "Hi. Just trying the mail example" & vbCrLf
Mailer.BodyText = "Line 2"
Mailer.BodyText = "Line 3"
If Mailer.SendMail then
Msg = "mail sent sucessfully!"
Else
Msg = "mail <b>not</b> sent sucessfully"
msg = msg & "<br>" & mailer.response
End If
response.write Msg

set mailer=nothing
%>

Ianpbaker
Aug 14th, 2000, 06:00 AM
Are you trying to this locally first or straight on to the server because if your doing it on PWS it won't work

Hope this helps

Ian

lirlir
Aug 14th, 2000, 06:12 AM
no i m running it straight from the ewebcity server.

way aint that working i m going crazy !!!

pls Ian help me .

lirlir
Aug 14th, 2000, 06:19 AM
well i know way it aint working , the aspmail component is
installed for Premium Members ONLY.
so i guess it can't be done unless u guys know something
that i dont.

Ianpbaker
Aug 14th, 2000, 06:22 AM
The only reason I can think of this not working is that it is a different version of ASPMail That ewebcity is using because the error you are getting is because the server can't find the class.

Try going to
http://www.serverobjects.com/products.htm#aspmail and see if you can find out anything, alteratley get in touvh with eweb and see what they say.

:(
Sorry I couldn't be much more help, but the code I gave you is correct For ASPMAIL

Ian

Aug 14th, 2000, 05:25 PM
Well first off you've changed the action argument of the form to "mailto:..." it needs to be the realtive path of the asp script that processes it.

As for them mailer object...check with eWebCity exactly what the class name for it is...an what the names of the properties/methods that it supports are. :)