473,385 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

send email using javascript

5
i want to sen email using javascript but its not working using mailto
Dec 20 '06 #1
4 28598
steven
143 100+
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 Expert 4TB
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.com) 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='mailto:you@youremail.com ?subject=The subject you want to appear&cc=she@heremail.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
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.com) 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='mailto:you@youremail.com ?subject=The subject you want to appear&cc=she@heremail.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
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(emailAddress)
Dim oSmtp As New System.Net.Mail.SmtpClient("smtp host", port)

Dim oMessage As New System.Net.MailMessage

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

oSmtp.Send(oMessage)
End Sub

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

oSmtp.UseDefaultCredentials = False
Dim myCreds As New System.Net.Mail.Credentials("username", "password")
oSmtp.Credentials = 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
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 ...
13
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...
1
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...
15
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. ...
9
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
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...
1
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...
1
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"...
2
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...
4
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 ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
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,...
0
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...

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.