rajmohan Posted September 21, 2006 Share Posted September 21, 2006 Hello guy i am my friend discussed about javascript : the topic is whether can we send mail through javascript i told that it is possible. BUT my friend told that it is not possible I need the correct solution for this one and coding also please help me Quote Link to comment https://forums.phpfreaks.com/topic/21510-through-javascript-can-we-send-mail/ Share on other sites More sharing options...
wildteen88 Posted September 21, 2006 Share Posted September 21, 2006 AFAIK javascript doesnt have that sort of ability. Javascript runs on the client and can only do client side operations, so it cannot talk to the server to send an email from the local mail server that might be installed. If you want to send an email from your site you'll want to use a server side programming langauge in order to send an email, such as PHP and use the built in mail function - provided you have a local SMTP server installed and PHP is setup to use that SMTP server.Or your friend might be getting his wires crosed with jsp, which is a server side version of javascript. Which I belive can send emails. Quote Link to comment https://forums.phpfreaks.com/topic/21510-through-javascript-can-we-send-mail/#findComment-95959 Share on other sites More sharing options...
rajmohan Posted September 21, 2006 Author Share Posted September 21, 2006 <!-- Beginfunction isPPC() {if (navigator.appVersion.indexOf("PPC") != -1) return true;else return false;}if(isPPC()) {document.write('<b>Send <A CLASS="contact" HREF=\"mailto:\?subject\=Take a look at this page I found, ' + document.title + '?body=You can see this page at: ' + window.location + '\" onMouseOver="window.status=\'Send your friends e-mail about this page\'; return true" TITLE="Send your friends e-mail about this page">this page<\/A> to a friend</b>');}else { document.write('<b>Send <A CLASS="contact" HREF=\"mailto:\?body\=Take a look at this page I found, ' + document.title + '. You can see this page at: ' + window.location + '\" onMouseOver="window.status=\'Send your friends e-mail about this page\'; return true" TITLE="Send your friends e-mail about this page">this page<\/A> to a friend</b>');}// End -->then what is the use of this one whether this coding will send mail please tell me i dont know Quote Link to comment https://forums.phpfreaks.com/topic/21510-through-javascript-can-we-send-mail/#findComment-95967 Share on other sites More sharing options...
wildteen88 Posted September 21, 2006 Share Posted September 21, 2006 That is not sending the mail. What that does is opens up your email client, eg Outlook Express, Thunderbird or what ever your email client is. It is then down to you to send the email yourself by clicking the Send button in your email client. Plus its not javascript either. Its actually to do with the [b]mailto:[/b] protocol for your link. You're using javascript to populate the email subject and the body of the email. Quote Link to comment https://forums.phpfreaks.com/topic/21510-through-javascript-can-we-send-mail/#findComment-95972 Share on other sites More sharing options...
rajmohan Posted September 21, 2006 Author Share Posted September 21, 2006 atleast we cannot able to sendsender nametomessagein java script Quote Link to comment https://forums.phpfreaks.com/topic/21510-through-javascript-can-we-send-mail/#findComment-95974 Share on other sites More sharing options...
wildteen88 Posted September 21, 2006 Share Posted September 21, 2006 You'll have to add those bits in if you want to send them with the email. Quote Link to comment https://forums.phpfreaks.com/topic/21510-through-javascript-can-we-send-mail/#findComment-95976 Share on other sites More sharing options...
rajmohan Posted September 21, 2006 Author Share Posted September 21, 2006 So only through outlook we can send mail right.like php we cannot send mail in javascript right??? Quote Link to comment https://forums.phpfreaks.com/topic/21510-through-javascript-can-we-send-mail/#findComment-95979 Share on other sites More sharing options...
wildteen88 Posted September 21, 2006 Share Posted September 21, 2006 No the mail: protocol will open up your defualt email client. You send you email through that. PHP on the other hand uses an SMTP server to send the email when you use the mail function. Quote Link to comment https://forums.phpfreaks.com/topic/21510-through-javascript-can-we-send-mail/#findComment-95995 Share on other sites More sharing options...
rajmohan Posted September 21, 2006 Author Share Posted September 21, 2006 Thank you very much Quote Link to comment https://forums.phpfreaks.com/topic/21510-through-javascript-can-we-send-mail/#findComment-96015 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.