Hi,
Ive producd code to send an email after capturing info off a form,it works fine locally but when i put it live it doesnt work! the code is stopin at 'msg.send' any ideas,
here the code! - <%
-
option explicit
-
-
'---------------------------------------------------------------------------------------------------
-
'FORM MAIL SCRIPT
-
'----------------
-
'usage:
-
'<form ACTION="sendmail_cdo.asp" ...>
-
'
-
'hidden fields:
-
' redirect - the url to redirect to when the mail has been sent (REQUIRED)
-
' mailto - the email address of the recipient (separate multiple recipients with commas) (REQUIRED)
-
' cc - the email address of the cc recipient (separate multiple recipients with commas) (OPTIONAL)
-
' bcc - the email address of the bcc recipient (separate multiple recipients with commas) (OPTIONAL)
-
' mailfrom - the email address of the sender (REQUIRED)
-
' subject - the subject line of the email (REQUIRED)
-
' message - the message to include in the email above the field values. not used when a template is being used. (OPTIONAL)
-
' template - specifies a text or html file to use as the email template, relative to the location of the sendmail script. (e.g. ../email.txt)
-
' A template should reference form fields like this: [$Field Name$]
-
' html - if this has the value "yes", the email will be sent as an html email. only used if a template is supplied.
-
' testmode - if this is set to "yes", the email contents will be written to the screen instead of being emailed.
-
'---------------------------------------------------------------------------------------------------
-
dim pde : set pde = createobject("scripting.dictionary")
-
'---------------------------------------------------------------------------------------------------
-
'PREDEFINED ADDRESSES for the "mailto" hidden field
-
'if you don't want to reveal email addresses in hidden fields, use a token word instead and specify
-
'below which email address it applies to. e.g. <input type="hidden" name="mailto" value="%stratdepartment%">
-
'ALSO, in the same way, you can use %mailfrom% to hide the originating email address
-
pde.add "%contactform%", "kenny.norris@257oops.com"
-
pde.add "%salesenquiry%", "dave@257oops.com"
-
'---------------------------------------------------------------------------------------------------
-
-
function getTextFromFile(path)
-
dim fso, f, txt
-
set fso = createobject("Scripting.FileSystemObject")
-
if not fso.fileexists(path) then
-
getTextFromFile = ""
-
exit function
-
end if
-
set f = fso.opentextfile(path,1)
-
if f.atendofstream then txt = "" else txt = f.readall
-
f.close
-
set f = nothing
-
set fso = nothing
-
getTextFromFile = txt
-
end function
-
-
dim redir, mailto, mailfrom, subject, item, body, cc, bcc, message, html, template, usetemplate, testmode
-
redir = request.form("redirect")
-
mailto = request.form("mailto")
-
if pde.exists(mailto) then mailto = pde(mailto)
-
cc = request.form("cc")
-
bcc = request.form("bcc")
-
mailfrom = request.form("mailfrom")
-
if mailfrom = "" then mailfrom = pde("%mailfrom%")
-
subject = request.form("subject")
-
message = request.form("message")
-
template = request.form("template")
-
testmode = lcase(request.form("testmode"))="no"
-
-
if len(template) > 0 then template = getTextFromFile(server.mappath(template))
-
if len(template) > 0 then usetemplate = true else usetemplate = false
-
dim msg : set msg = server.createobject("CDO.Message")
-
msg.subject = subject
-
msg.to = mailto
-
msg.from = mailfrom
-
if len(cc) > 0 then msg.cc = cc
-
if len(bcc) > 0 then msg.bcc = bcc
-
-
if not usetemplate then
-
body = body & message & vbcrlf & vbcrlf
-
else
-
body = template
-
end if
-
for each item in request.form
-
select case item
-
case "redirect", "mailto", "cc", "bcc", "subject", "message", "template", "html", "testmode"
-
case else
-
if not usetemplate then
-
if item <> "mailfrom" then body = body & item & ": " & request.form(item) & vbcrlf & vbcrlf
-
else
-
body = replace(body, "[$" & item & "$]", replace(request.form(item),vbcrlf,"<br>"))
-
end if
-
end select
-
next
-
-
if usetemplate then
-
dim rx : set rx = new regexp
-
rx.pattern = "\[\$.*\$\]"
-
rx.global = true
-
body = rx.replace(body, "")
-
end if
-
-
if usetemplate and lcase(request.form("html")) = "yes" then
-
msg.htmlbody = body
-
else
-
msg.textbody = body
-
end if
-
if testmode then
-
if lcase(request.form("html")) = "yes" then
-
response.write "<pre>" & vbcrlf
-
response.write "Mail to: " & mailto & vbcrlf
-
response.write "Mail from: " & mailfrom & vbcrlf
-
if len(cc) > 0 then response.write "Cc: " & cc & vbcrlf
-
if len(bcc) > 0 then response.write "Bcc: " & bcc & vbcrlf
-
response.write "Subject: " & subject & vbcrlf & string(80,"-") & "</pre>"
-
response.write body
-
else
-
-
response.write "<html><head><title>Sendmail_cdo.asp Test Mode</title></head><body><pre>" & vbcrlf
-
response.write "Mail to: " & mailto & vbcrlf
-
response.write "Mail from: " & mailfrom & vbcrlf
-
if len(cc) > 0 then response.write "Cc: " & cc & vbcrlf
-
if len(bcc) > 0 then response.write "Bcc: " & bcc & vbcrlf
-
response.write "Subject: " & subject & vbcrlf & vbcrlf
-
response.write string(80,"-") & vbcrlf & vbcrlf & "<span style=""color:blue;"">"
-
response.write body & "</span>" & vbcrlf & vbcrlf
-
response.write string(80,"-") & vbcrlf & "**END OF EMAIL**</pre></body></html>"
-
end if
-
else
-
-
msg.Send
-
response.redirect redir
-
-
-
end if
-
set msg = nothing
-
%>
2 2476 epots9 1,351
Recognized Expert Top Contributor
that is asp, there is no javascript.
the issue could be with the SMTP server.
what could the problem be?been trying to sort it out for days!! help!!
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: John Silver |
last post by:
I have a perl script running on machine A, a web server. A visitor
completes certain pieces of data and these are compiled into two emails, one
addressed to the visitor and copied to the site owner, the other addressed
to the webmaster and including cookie and timing data for debugging.
The email is sent by machine B which is the email server for the domain.
Here are some config values for the perl script, names have been changed to...
|
by: Devonish |
last post by:
I am composing an email with Access VB and then sending it from within
Access.
Everything works correctly (the email actually goes!) but Outlook ask
some
irritating questions that the user is required to answer. A summary of
the
relevant code is:
Dim mailObj as Outlook.MailItem
|
by: Susan Bricker |
last post by:
I would like to generate a report (I have the report working already)
using MS/ACCESS 2000 and then have the ability to send the report as an
email attachment to my colleagues. I have looked around in the
MS/ACCESS Help facility and found that I can click on FILE (on the Menu
Bar) and then click on SEND TO. This will generate, either, a 'Snapshot
format' or 'Rich Text Format' file and send an email.
Two problems:
1. Is it possible to...
|
by: Ron |
last post by:
hi guys,
I am trying to send email using smtpMail.
I can send emails inside the organization, but out of the organization I get
an error "The server rejected one or more recipient addresses. The server
response was: 550 5.7.1 Unable to relay for ........"
now I tried to add username and password for the server to relay but it is
still not working.
this is the example i used:
|
by: Corvus |
last post by:
Hi, we have an ASP.Net web application where users fill out a questionnaire
and the the application emails them an employment report. The customer
requires the report be sent as an email, so we create a web page and send it
via System.Web.Mail.SmtpMail.Send.
This has several problems; testing and the customer report that occasionally
the page that sends the email takes so long to draw, they give up and close
the browser window. It seems...
| |
by: Dave |
last post by:
I have a form on my ASP 3.0 web site and I need to monitor submissions.
Is it possible to generate an email upon form submission?
If so, how do I invoke the email functionality from an ASP 3.0 page?
Thanks
Dave
|
by: Jed |
last post by:
I have a form that needs to handle international characters withing the UTF-8
character set. I have tried all the recommended strategies for getting utf-8
characters from form input to email message and I cannot get it to work. I
need to stay with classic asp for this.
Here are some things I tried:
'CDONTS
Call msg.SetLocaleIDs(65001)
|
by: Homer |
last post by:
Hi,
I just got a requirement from my HR department to automate their form
submission process and integrate it into the Intranet project that I
had just completed Phase 1 of. Because of the short time frame that
I've been given, a week to be exact, I do not have the luxury to
explore it on my own so here are the requirements:
1. Automate the personnel forms that employees use for changing their
information, which is currently in pdf...
|
by: shansivamani |
last post by:
using SMTP to send email.
is there any settings need to be configured apart from Host name and
Port, while sending emails using SMTPClient in .Net?
when i try to send mail to ids which has only one dot in the domain
name (eg : test@abc.com) there are no issues.
but when the mail ids are like (test@abc.co.in or test@abc.rr.com) the
mail is not getting received by those ids.
also, there are no exceptions occured when i debugged it.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |