webForumDet fria alternativet

jmail problem

1 svar · 234 visningar · startad av Qonos

QonosMedlem sedan sep. 2000438 inlägg
#1

jag skall först och främst säga att ASP e inte min grej :( har inte kodat typ en rad i asp på 2½ år eller nått så jag e lite "ringrostig"

jag hittade denna koden:

First of all we need a form which posts to our JMail page. 
   JmailForm.asp
<html>
<head>
<title>emailform</title>
</head>
<body>
<form method="post" action="SendMail.asp">
   Complete this form and click the submit-button. We will answer your
   questions as soon as possible.
   <br><br>
   Your name<br>
   <input type="text" size="25" name="name"><br>
   
   Your email<br>
   <input type="text" size="25" name="email"><br>   Recipient email<br>
   <input type="text" size="25" name="recipient"><br> State your business<br>
   <select name="subject" size="1">
    <option value="help">help
       <option value="tips">tips
       <option value="other">other
   </select>
   <br> Enter your question<br>
   <textarea name="body" cols="40" rows="15" wrap="PHYSICAL"></textarea>
   <br>
   <input type="submit" value="  Submit ">
</form>
</body>
</html> 

Then we need to catch the post and read the form. Pick up all information and create the e-mail.
 
   SendMail.asp

<%@LANGUAGE = VBSCRIPT%> <html>
<body>

<%

' Get the form data
name        = Request.Form("name")
senderEmail = Request.Form("email")
subject    = "Regarding " & Request.Form("subject")
recipient   = Request.Form("recipient")
body        = Request.Form("body")

' Create the JMail message Object
set msg = Server.CreateOBject( "JMail.Message" )

' Set logging to true to ease any potential debugging
' And set silent to true as we wish to handle our errors ourself
msg.Logging = true
msg.silent = true

' Enter the sender data
msg.From = senderEmail
msg.FromName = name

' Note that as addRecipient is method and not
' a property, we do not use an equals ( = ) sign
msg.AddRecipient recipient

' The subject of the message
msg.Subject = subject

' And the body
msg.body = body

' Now send the message, using the indicated mailserver
if not msg.Send("mail.myDomain.net" ) then
    Response.write "<pre>" & msg.log & "</pre>"
else
    Response.write "Message sent succesfully!"
end if

' And we're done! the message has been sent.

%>
</body>
</html>

Det kan vara jag som har glömt allt inom ASP men hmm jag hittar inte var mottagar mailadressen skall skrivas in....

@ndersMedlem sedan juni 200032 969 inlägg
#2

Du har med msg.AddRecipient recipient i din kod. Den förväntar sig alltså att mottagaradressen ligger i variabeln recipient.

Mvh,

127 ms totalt · 3 externa anrop · v20260731065814-full.30151723
0 ms — hämta forumlista (cache)
0 ms — hämta statistik (cache)
124 ms — hämta tråd, inlägg och bilagor (db)