473,796 Members | 2,658 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

send email using javascript

5 New Member
i want to sen email using javascript but its not working using mailto
Dec 20 '06 #1
4 28614
steven
143 New Member
mailto is what you would attach to an anchor tag to alert the browser that the link is an email address and to load an email client if one is available.

It sounds like you want to give users the ability to fill in a form on your webpage and then they can send it to you, right? Well Javascript isn't the language for this. Javascript is a clientside language. You need a server side language, such as PHP, Perl, ASP, JSP etc...

The server would have to be configured to send mail.
Dec 20 '06 #2
ronverdonk
4,258 Recognized Expert Specialist
Instead of constructing the email yourself, you can make a button that, when clicked, opens the default email client of the user (e.g. Outlook Express, etc.). The following sample (source: JavaScriptKit.c om) puts a simple button on the screen. When clicked it opens the user's email client with the To:, Cc: and Subject already filled in.
[html]<form>
<input type="button" value="Contact Us" onclick="parent .location='mail to:you@youremai l.com?subject=T he subject you want to appear&cc=she@h eremail.com'">
</form>[/html]

When you decide that you want to make your own email form, you can see a sample of the PHP code for that at the following thread in the HTML forum http://www.thescripts.com/forum/post2268656-6.html

Ronald :cool:
Dec 20 '06 #3
dipal
5 New Member
Actually i want to send the newsletter to visitor of my site who enter their email id on my site.And i have also keep email link on my site for both i have used mailto.I have done this using mailto and i get the outlook express screnn also but when i click on send at that time i got the error that method post is not allowed for that shall i have to configure the outlook express


Instead of constructing the email yourself, you can make a button that, when clicked, opens the default email client of the user (e.g. Outlook Express, etc.). The following sample (source: JavaScriptKit.c om) puts a simple button on the screen. When clicked it opens the user's email client with the To:, Cc: and Subject already filled in.
[html]<form>
<input type="button" value="Contact Us" onclick="parent .location='mail to:you@youremai l.com?subject=T he subject you want to appear&cc=she@h eremail.com'">
</form>[/html]

When you decide that you want to make your own email form, you can see a sample of the PHP code for that at the following thread in the HTML forum http://www.thescripts.com/forum/post2268656-6.html

Ronald :cool:
Dec 21 '06 #4
b00tdash
2 New Member
Yes,

It would have to be done using server side code. Since it is easy to do in ASP.NET VB or C# I'll demonstrate how.

Assume when the visitor enters the email address it is stored in a database and you retrieve it using the appropriate driver.

VB. 2k5

Sub sendMail(emailA ddress)
Dim oSmtp As New System.Net.Mail .SmtpClient("sm tp host", port)

Dim oMessage As New System.Net.Mail Message

With oMessage
.To.Add(New System.Net.Mail .MailAddress(em ailAddress)
.From = new System.Net.Mail .MailAddress("s ender@me.com")
.Subject = "Enter Subject"
.Body = "Enter Message Body Here"
End With

oSmtp.Send(oMes sage)
End Sub

If you use authentication credentials for your outbound smtp before you send insert:

oSmtp.UseDefaul tCredentials = False
Dim myCreds As New System.Net.Mail .Credentials("u sername", "password")
oSmtp.Credentia ls = myCreds

You can also enable SSL.

.NET 1.1 is much different and inferior so if you do use ASP use .NET 2.0.

I don't know how to do it in classic ASP but it is also an alternative.

Try PHP too.
Dec 25 '06 #5

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

Similar topics

0
9876
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ********************************** package Celcom.Client;
13
2884
by: Richard H | last post by:
Hi, I am building a site for a client which has an enquiry form on it. Normally I would something like PHP to send the form but the client doesn't want to pay for a server that supports PHP, so the form is sent using the mailto: command within the <form> tag. This sends the email fine but it is rather messey. Could I use javascript to tidy up the form output and then send an email with the contents, similar to the 'Mail' command in PHP?...
1
4498
by: mhawkins19 | last post by:
I have a form built and on the onclick event I validate all of the fields and then if the form is ok, on the submit event I run a javascript function to set a cookie and download a file from the current window. I have a cgi script provided by my web host to send the contents of the form through email but they only show me how to use the cgi script to send email through the submit event of the form. ie. <form name="downloadform"...
15
3319
by: Steve Horrillo | last post by:
I can't figure out why this script won't insert the subject in the email and why can't I control the font and size being used? I'm not sure where to post this. Let me know where if this is OT. <SCRIPT LANGUAGE="JavaScript"> <!-- Begin function isPPC() { if (navigator.appVersion.indexOf("PPC") != -1) return true; else return false;
9
77444
by: Mahernoz | last post by:
Can i send an email from JavaScript? Is it possible? If yes please the code to send email using javascript...
4
4865
by: David A. Beck | last post by:
I need to enter data on a web page. I have been able to navigate using the VB.NET WebBrowser control and see the contents of each page. What I need to do now is to fill in the controls on the page with text and send an <enter> key. If WebBrowser can't do this, does anyone know of a different managed control that can do this? Dab
1
2716
by: steinwaygirl | last post by:
Hi all, I have been searching so hard for the answer to this, hopefully some of you all can help. I have created an HTML file with various forms - also included CSS and some javascript for checkboxes and autofill of Identical forms, as well as pulldown menus. When I fill out a form and (on the IE browser pull down menu) select: File --> Send --> Page by Email, the page goes into MS outlook (as it should) - However, all of the data is...
1
4016
by: Malli mindwave | last post by:
Hi, I want to send form data to given email id, I'm using mailto:ur@mail.com, but it doesn't working it dirsctly goes to localSystem A/C i.e outlook.. <form name="form1" method="post" action="mailto:malli921@gmail.com" enctype="text/plain">
2
5637
by: Malli mindwave | last post by:
Hi, We are using the yahoowebHostiing service for my company website, In that one screen of the SendComments/FeedBack section is there, I'm basically dot.net develeoper ,but yahoowebhosting not support .asp,.aspx files, it supports PHP files, I'm searching in JavaScript ,but not found any matter, I'don't Know PHP.I'm having lot of pressure of higer officials.Please help me on this.
4
1958
by: shailendra deshpande | last post by:
right now i have only pain html page.and i want to send email through it using javascript plz. anybody tell me how to send email from plain html page using javascript. thanks in advance Shailendra Deshpande
0
9685
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
10461
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
10239
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...
0
9057
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...
1
7555
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6796
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();...
0
5579
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4122
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2928
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.