Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
May 16, 2012, 05:44:08 PM

Pages: [1]   Go Down
  Print  
Author Topic: sending e-mail via asp and SMTP  (Read 1297 times)
Elad Dali
Newbie
*
Offline Offline

Posts: 1


« on: July 27, 2008, 12:53:35 AM »

Hi,

I am trying for 2 weeks to solve this problem.

I am trying to send an e-mail throw my web site.
My real e-mail address is arrotop@ netvision.net.il,
But I am using a RULE, all my the e-mail I am sending from sales@arrowmid.com

can anyone help me with working asp code that will help me sending e-mail from sales@arrowmid.com, the smtp address is mailgw.netvision.net.il.

The code that I have, the one that is not working is:

<%@codepage=1255%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1255">
<!--#include file = "security.asp" -->
</HEAD>
<%
set conn = Server.CreateObject ("ADODB.connection")
conn.Open "DBQ=" & Server.Mappath("DBs/SiteDB.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"

name     = replace(geresh(Request.Form ("name")),"'","&#39;")
phone    = replace(geresh(Request.Form ("phone")),"'","&#39;")
email    = replace(geresh(Request.Form ("email")),"'","&#39;")

if Day(date())<10 then
   dd = "0" & Day(date())
else
   dd = Day(date())
end if
if Month(date())<10 then
   mm = "0" & Month(date())
else
   mm = Month(date())
end if
Ndate = dd & "/" & mm & "/" & Year(date())

title    = replace(geresh(Request.Form ("title")),"'","&#39;")
UserText = replace(Request.Form ("opinion"),"'","&#39;")
UserText = replace(UserText,"&nbsp;"," ")
'UserText = replace(UserText,"&amp;","&lt;BR&gt;")
'UserText = replace(UserText,vbCrLf,"<BR>")
'UserText = replace(UserText,chr(13),"<BR>")
'UserText = replace(UserText,chr(10),"<BR>")

sql="INSERT INTO Opinions2 (name,email,phone,title,oDate,remarks)"
sql = sql & " VALUES('" & name
sql = sql & "','" & email
sql = sql & "','" & phone
sql = sql & "','" & title
sql = sql & "','" & Date
sql = sql & "','" & UserText & "')"

conn.Execute sql

conn.Close
set conn=nothing

strBody = ""
strBody = strBody & "<HTML><HEAD><meta http-equiv='Content-Type' content='text/html;charset=windows-1255'></HEAD><BODY>"
strBody = strBody & "<DIV align='right' dir='rtl'><font face='Arial'>"
strBody = strBody & Server.HTMLEncode("שלום ") & Server.HTMLEncode(name) & ", <BR>"
strBody = strBody & Server.HTMLEncode("תודה על  פנייתך לחברת ארומיד, ") & "<BR>"
strBody = strBody & Server.HTMLEncode("פנייתך חשובה לנו, אנו ניצור קשר בהקדם האפשרי, ") & "<BR><BR>"
strBody = strBody & Server.HTMLEncode("בברכה, ") & " <BR><BR><BR>"
strBody = strBody & "<B>" & Server.HTMLEncode("קבוצת ארומיד") & "</B><BR>"
strBody = strBody & Server.HTMLEncode("משרד ראשי") & "<BR>"
strBody = strBody & Server.HTMLEncode("כתובת: רח' יגאל אלון 127 תל אביב") & "<BR>"
strBody = strBody & Server.HTMLEncode("טלפון: 03-6247080") & "<BR>"
strBody = strBody & Server.HTMLEncode("פקס: 03-5620208") & "<BR>"
strBody = strBody & Server.HTMLEncode("כתובת אתר אינטרנט: www.arrowmid.com") & "<BR>"
strBody = strBody & Server.HTMLEncode("כתובת מייל: info@arrowmid.com") & "<BR><BR><BR>"
strBody = strBody & "<U>" & Server.HTMLEncode("פרטי הפנייה:") & "</U><BR>"
strBody = strBody & Server.HTMLEncode("שם: ") & Server.HTMLEncode(name) & "<BR>"
strBody = strBody & Server.HTMLEncode("מייל: ") & Server.HTMLEncode(email) & "<BR>"
strBody = strBody & Server.HTMLEncode("כותרת: ") & Server.HTMLEncode(title) & "<BR><BR>"
strBody = strBody & Server.HTMLEncode("תוכן: ") & Server.HTMLEncode(UserText) & "<BR>"
strBody = strBody & "</DIV></BODY></HTML>"

strBody2 = ""
strBody2 = strBody2 & "<HTML><HEAD><meta http-equiv='Content-Type' content='text/html;charset=windows-1255'></HEAD><BODY>"
strBody2 = strBody2 & "<DIV align='left' dir='ltr'><font face='Arial'>"
strBody2 = strBody2 & Server.HTMLEncode("Dear ") & Server.HTMLEncode(name) & ", <BR>"
strBody2 = strBody2 & Server.HTMLEncode("Thank you for submitting a request for more information. A representative will be contacting you shortly.") & "<BR>"
strBody2 = strBody2 & Server.HTMLEncode("Thank you,") & "<BR><BR><BR>"
strBody2 = strBody2 & "<B>" & Server.HTMLEncode("ARROWMID GROUP LTD") & "</B><BR>"
strBody2 = strBody2 & Server.HTMLEncode("Address: Igal Alon 127, Tel Aviv") & "<BR>"
strBody2 = strBody2 & Server.HTMLEncode("Phone:  972-3-6247080 ") & "<BR>"
strBody2 = strBody2 & Server.HTMLEncode("Fax: 972-3-5620208") & "<BR>"
strBody2 = strBody2 & Server.HTMLEncode("Web-Site: www.arrowmid.com") & "<BR>"
strBody2 = strBody2 & Server.HTMLEncode("E-Mail: info@arrowmid.com") & "<BR><BR><BR>"
strBody2 = strBody2 & "<U>" & Server.HTMLEncode("Request Details:") & "</U><BR>"
strBody2 = strBody2 & Server.HTMLEncode("Name: ") & Server.HTMLEncode(name) & "<BR>"
strBody2 = strBody2 & Server.HTMLEncode("E-mail: ") & Server.HTMLEncode(email) & "<BR>"
strBody2 = strBody2 & Server.HTMLEncode("Subject: ") & Server.HTMLEncode(title) & "<BR><BR>"
strBody2 = strBody2 & Server.HTMLEncode("Contents: ") & Server.HTMLEncode(UserText) & "<BR>"
strBody2 = strBody2 & "</DIV></BODY></HTML>"


Dim iMsg
Dim iConf
Dim Flds
Dim strHTML
Dim strSmartHost
Const cdoSendUsingPort = 2
StrSmartHost = "localhost"
set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
With Flds
.Item ("http://schemas.microsoft.com/cdo/configuration/languagecode")="windows-1255"
'.Item("urn:schemas:mailheader:content-type") = "text/html; charset=windows-1255"
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSmartHost
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
.Update
End With

With iMsg
Set .Configuration = iConf
.To = email
.BCC = "elad@arrowmid.com"
.From = "elad@arrowmid.com"
if Request.Form ("ENG")="1" then
   .Subject = "Thank you from Arrowmid Group"
   .HTMLBody = replace(strBody2,vbCrLf,"<BR>")
else
   .Subject = "Thank you from Arrowmid Group"
   .HTMLBody = replace(strBody,vbCrLf,"<BR>")
end if

.Send
End With

Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing

if Request.Form ("ENG")="1" then
   Response.Redirect "dataEng.asp?id=42"
else
   Response.Redirect "data.asp?id=42"
end if
%>


Thanks
Elad Dali
Arrowmid
Logged
Pages: [1]   Go Up
  Print  
 
Jump to: