473,804 Members | 3,745 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sending an email using ASP

12 New Member
I hope someone can help me. I'm trying to setup an ASP page that will automatically send and email once the submit button is clicked. But my problem is that Lotus Notes is the email client and the script below is setup for Outlook to be the client. I've tried looking on the web but I can't seem to find anything that helps. Can anyone help me alter the code below so that it will work with Lotus Notes?

<%

if not IsEmpty(Request .Form("Send")) then
if Request.Form("S endTo") = "All" then
set RSEmails = conn.Execute("s elect EmpEmailAddress from I1BlastEmps")
elseif Request.Form("S endTo") = "Department " then
set RSEmails = conn.Execute("s elect EmpEmailAddress from I1BlastEmps " _
& "where Department = '" & Request.Form("D epartmentName") & "'")
else
set RSEmails = conn.Execute("s elect EmpEmailAddress from I1BlastEmps " _
& "where Role = '" & Request.Form("R oleName") & "'")
end if
set RSWhoForm = conn.Execute("S elect EmpID, EmpEmailAddress from I1BlastEmps " _
& "where EmpID = " & Request.Form("E mpID"))
FromAddress = RSWhoForm("EmpE mailAddress")
do Until RSEmails.eof
set objMail = CreateObject("C DONTS.NewMail")
objMail.Send FromAddress,RSE mails("EmpEmail Address"), _
cstr(Request.Fo rm("Subject")), cstr(Request.Fo rm("Message"))
set objmail = nothing
RSEmails.MoveNe xt
loop
conn.Execute "Insert Into I1Blasts (EmpID, Subject, Message, WhenSent) values (" _
& "" & Request.Form("E mpID") & ", " _
& "'" & Request.Form("S ubject") & "', " _
& "'" & Request.Form("M essage") & "', " _
& "'" & Now() & "')"

TheMessage = "Message was sent!"
else
TheMessage = "Enter your message below"
end if

set RSDepartments = conn.Execute("s elect distinct Department from " _
& "I1BlastEmp s order by Department")
set RSRoles = conn.Execute("s elect distinct Role from " _
& "I1BlastEmp s order by Role")
set RSEmps = conn.Execute("s elect EmpID, EmpName from " _
& "I1BlastEmp s order by EmpName")

%>
Feb 8 '07 #1
4 2188
devsusen
136 New Member
do Until RSEmails.eof
set objMail = CreateObject("C DONTS.NewMail")
objMail.Send FromAddress,RSE mails("EmpEmail Address"), _
cstr(Request.Fo rm("Subject")), cstr(Request.Fo rm("Message"))
set objmail = nothing
RSEmails.MoveNe xt
loop
I think you should write Server.CreateOb ject instead CreateObject. You should write this statement outside of the loop, otherwise it will create object every for sending the mail.

The script will send mail using the SMTP server. In that case email client is not that important matter. Almost same sort of script worked for me. I found no problem with it.

susen
Feb 9 '07 #2
Anthony1312002
12 New Member
Thanks for the response susen. I'm able to create the objMail object just fine. But I'm getting the error "(0x8007000 3) /EmailBlast.asp, line 25". Line 25 is where I try to send the email. Using objMail.Send. How can I fix this?


set objMail = Server.CreateOb ject("CDONTS.Ne wMail")

do Until RSEmails.eof

objMail.Send FromAddress,RSE mails("EmpEmail Address"), _
cstr(Request.Fo rm("Subject")), cstr(Request.Fo rm("Message"))


set objmail = nothing
RSEmails.MoveNe xt
loop
Feb 9 '07 #3
devsusen
136 New Member
Hi,

objMail.Send FromAddress,RSE mails("EmpEmail Address"), _
cstr(Request.Fo rm("Subject")), cstr(Request.Fo rm("Message"))
Please try writing this way -

Expand|Select|Wrap|Line Numbers
  1. objMail.From = FromAddress
  2. objMail.To = RSEmails("EmpEmailAddress")
  3. objMail.Subject = cstr(Request.Form("Subject"))
  4. objMail.Body = cstr(Request.Form("Message"))
  5. objMail.Send
You need to set the required attributes first and then call the Send function. I hope this will work for you.

Susen
Feb 13 '07 #4
clain
79 New Member
My dear friend CDONTS wont work anymore.. use new CDOSYS
here is the code



<%
dim too,from,messag e,subject
from=request.Fo rm("txtTo")
too=request.For m("txtFrom")
subject=request .Form("textSubj ect")
message=request .Form("message" )


'------------------------------Configuration-------------------
sch = "http://schemas.microso ft.com/cdo/configuration/"
Set cdoConfig = Server.CreateOb ject("CDO.Confi guration")
cdoConfig.Field s.Item(sch & "sendusing" ) = 2
cdoConfig.Field s.Item(sch & "smtpserver ") = "192.168.29 .20"
cdoConfig.field s.update
'-------------------------------------------------------------
Set myMail=CreateOb ject("CDO.Messa ge")
myMail.Configur ation = cdoConfig
myMail.Subject= subject
myMail.From=fro m
myMail.To=too
myMail.TextBody =message
myMail.Send
set myMail=nothing
response.write( "your mail has been send")

%>

Happy coding
Feb 19 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

13
3233
by: joe215 | last post by:
I want my users to send emails from a Windows app that I am developing in Visual Basic.NET 2003. I found a good example of sending email to a SMTP server using the SmtpMail class. However, using this, it seems, that the user must install IIS on their computer. Isn't there a class that will detect whatever mail server is available on a computer and use that? How do I create this functionality without having the user add any other...
2
2231
by: kimberly.shaffer | last post by:
Okay, I can automate sending of multiple emails with records using Groupwise and Access DB. But now what I need to do is send multiple fields associated with one field out automatically and can't figure out how to do it. For instance, my records look like this: strEmail strGroup jjohns@comcast.net catlovers jjohns@comcast.net doglovers
17
2911
by: Bonj | last post by:
Right guys. (I would like a solution to this in VB6 as this is what our needy app is written in, but any solutions that involve .NET would be much appreciated likewise as I could instantiate them, otherwise please forgive the crossposting.) I'm sure I've seen posts here before criticising the practice of automating outlook for the purpose of programatically sending email, on the grounds that it's naff. Well now we're really landed in...
9
3228
by: B-Dog | last post by:
I've built a small app that sends mail through our ISP's SMTP server but when I try to send through my local exchange server I get CDO error. Does webmail use SMTP or does it strictly rely on CDOmail. I don't want to use the Outlook reference because outlook prompts each time program access it and I have found a way to disable that. Can I use webmail with exchange? Thanks
3
3626
by: Ant | last post by:
Hi, I'm using the MailMessage & smtpMail classes in System.Web.Mail to send mail, however it's not sending any emails. I'm using it on a Windows 2003 server. The simplest way to use this is smtpMail.Send("from@here.com", to@there.com, "Message subject", "Message Body") I'm sending it to my own email address on a different server using a dummy
6
2755
by: Anuradha | last post by:
Dear All How can i send mails using vb.net Thanx all
1
8187
by: Eric Sheu | last post by:
Greetings, I have been searching the web like mad for a solution to my SMTP problem. I am using Windows Server 2003 and ASP.NET 2.0 w/ C# to send out e-mails from a web site I have created to the members of my organization. I think my problem is incorrectly setting the settings on my server or an authentication problem. Here is the code I have written to send a test message: -----Code Begins: Sensitive Information Replaced by -----...
4
5057
by: Roger Withnell | last post by:
I'm sending Russian text in an email generated from the website which displays in the email as ?????????? The website is set to codepage 65001 and the charset to utf-8. Please advise. Posted Via Usenet.com Premium Usenet Newsgroup Services
7
9848
by: undbund | last post by:
Hi I am creating a newsletter system. The software should run from desktop computer (localhost) but be able to send email to anyone on the internet. Can you guys give me some ideas on how to achieve this. Thanks
10
5106
by: Markgoldin | last post by:
I am sending an XML data from not dontnet process to a .Net via socket listener. Here is a data sample: <VFPData> <serverdata> <coderun>updateFloor</coderun> <area>MD2</area> <zone>BOXING</zone> <status>Running</status> <job>1000139233</job>
0
9706
marktang
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...
0
9584
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,...
0
10583
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10337
jinu1996
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...
1
10323
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9160
agi2029
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...
0
6854
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();...
2
3822
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2995
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.