mailto , outlook , ASP ؟؟

sahar_me

Member
در سايتم از اين تگ استفاده كرده ام :
کد:
<"a href="mailto:[email protected]> 
mailto:[email protected]
<a/>
حالا ميخواهم كاربران بتوانند با كليك بر روي لينك حاصل و باز شدن outlook برايم ميل بزنند.
در ضمن هاستم JMail را پشتيباني ميكند .
حالا چطوري كدنويسي كنم و كجا كدها را بايد بنويسم؟
چطوري برنامه outlook موجود روي كامپيوتر كاربر را كنترل كنم ؟
در ضمن ASP كار ميكنم .
 

AliReza26

Active Member
خوب بله ديگه ....

وقتي كاربر روي لينكي كه دادي كليك كنند اوت لوك كاربر به منظور فرستادن ميل باز ميشه ...


در مورد سوال دوم :

اينم يه مثال براي فرستادن ميل با استفاده از JMail :

mailform.htm
کد:
<html>
<form method=post action=sendmail.asp>
From email: <input type=text name=sender><br>
To email: <input type=text name=receiver><br>
Subject: <input type=text name=subject><br>
Body: <textarea name=body></textarea><br>
<input type=submit>
</form>
</html>

sendmail.asp
کد:
<%
' Put your SMTP Mail server here. If you do not know, ask your network administrator
smtpServer = "smtp.yourSMTPServerNameHere.com"
smtpPort = 25

' ---
dim sender, subject, body, smtpServer, smtpPort
' Now gets the data from Form
sender = Request.Form("sender")
receiver = Request.Form("receiver")
subject = Request.Form("subject")
body = Request.Form("body")

Set mail = CreateObject ("JMail.SMTPMail") 
mail.ServerAddress = smtpServer & ":" & smtpPort
mail.Sender = sender
mail.Subject = subject
mail.AddRecipient receiver
mail.ContentType = "text/html" ' or you can put 'text/plain' for plain text email 
mail.ISOEncodeHeaders = false 
mail.ContentTransferEncoding = "8bit"
mail.Body = body

' 1 - highest priority (Urgent) ' 3 - normal ' 5 - lowest 
mail.Priority = 3


' Add sender's IP address (not required, but useful for web-based email)
mail.AddHeader "Originating-IP", Request.ServerVariables ("REMOTE_ADDR")

' Actually send mail
mail.Execute 
set mail = nothing

Response.write "Email sent OK!"
%>
 

sahar_me

Member
خوب اينطوري كه خودم با استفاده از فرم يه محيط براي فرستادن ايميل ميسازم !!!
1. چطوري چيزهايي كه كاربر در برنامه outlook مينويسد را بتواند برايم بفرستد ؟؟
2. در ضمن در خط چهارم از فايل دوم آدرس smtpserver حتما بايد اولش smtp باشد و آخرش .com چون آدرس smtp هاستم بصورت mail.myhost.net ميباشد ؟
سوال اول مهمترست !
 

sahar_me

Member
در ضمن كد را امتحان كردم ( روي سايتم ) ولي اين error را ميدهد
کد:
jmail.SMTPMail error '8000ffff' 

The message was undeliverable. All servers failed to receive the message 

/Content/mailto/webmaster.asp, line 38
كه به خط mail.Execute اشاره دارد .
لطف ميكني بگي مشكل چيه ؟؟
 

AliReza26

Active Member
اين كد استفاده كن و نتيجه را اينجا بگو....


کد:
<% 
' Put your SMTP Mail server here. If you do not know, ask your network administrator 
smtpServer = "smtp.yourSMTPServerNameHere.com" 
smtpPort = 25 

' --- 
dim sender, subject, body, smtpServer, smtpPort 
' Now gets the data from Form 
sender = Request.Form("sender") 
receiver = Request.Form("receiver") 
subject = Request.Form("subject") 
body = Request.Form("body") 

Set mail = CreateObject ("JMail.SMTPMail") 
mail.ServerAddress = smtpServer & ":" & smtpPort 
mail.Sender = sender 
mail.Subject = subject 
mail.AddRecipient receiver 
mail.ContentType = "text/html" ' or you can put 'text/plain' for plain text email 
mail.ISOEncodeHeaders = false 
mail.ContentTransferEncoding = "8bit" 
mail.Body = body 

' 1 - highest priority (Urgent) ' 3 - normal ' 5 - lowest 
mail.Priority = 3 


' Add sender's IP address (not required, but useful for web-based email) 
mail.AddHeader "Originating-IP", Request.ServerVariables ("REMOTE_ADDR") 

' Actually send mail 
objJMail.Silent = True
 
Dim bSuccess
bSuccess = objJMail.Execute()
 
' Check for exceptions
If bSuccess = False Then
    ' An error occurred
    Response.Write "<p>An error occurred, the email was not sent.</p>"
Else
    ' No errors occurred
    Response.Write "<p>Thank you, your email was sent.</p>"
End If

set mail = nothing 

Response.write "Email sent OK!" 
%>
 

جدیدترین ارسال ها

بالا