Archive for myfreeforum.org Before posting please check the "stickies" in the support forums.
Please ask questions in real English and not "txt". You will get a better response.
Please do not ask support questions via PMs.
 


       myfreeforum.org Forum Index -> Portal components
symon

Tell A Friend Portal

I have one upand running.

Http://testhtml.myfastforum.org

Question i have is how to adopt this to use the forum emailer rather than the submitters default email engine.



Code:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin



var initialsubj="Great Site for You to Check Out"
var initialmsg="Hi:\n You may want to check out this site: "+window.location
var good;
function checkEmailAddress(field) {

var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.sex)|(\.biz)|(\.aero)|(\.coop)|(\.museum)|(\.name)|(\.pro)|(\..{2,2}))$)\b/gi);
if (goodEmail) {
good = true;
}
else {
alert('Please enter a valid address.');
field.focus();
field.select();
good = false;
   }
}
u = window.location;
function mailThisUrl() {
good = false
checkEmailAddress(document.eMailer.email);
if (good) {

//window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+document.title+" "+u;
window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+initialmsg
   }
}
//  End -->
</script>


<form name="eMailer">
Tell a friend:
<input type="text" name="email" size="26" value="     Enter Friends Email Here" onFocus="this.value=''" onMouseOver="window.status='Enter email address here and tell a friend about this site...'; return true" onMouseOut="window.status='';return true">
<br>
<input type="button" value="Send this URL" onMouseOver="window.status='Click to send an email (with this page address) to a friend! Enter email address above...'; return true" onMouseOut="window.status='';return true" onClick="mailThisUrl();">
</form>


You cant use the emailer and copy it as there is no option to send to another email address all emails are going quite rightly to the forum admin.
symon

Nick feel free to add and customise if you see an avenue to make it better.
Nick(NR)

All I'd do is add styling, but that's a personal choice tbh
symon

Nudge Wink
Nick(NR)

A style defined version:

code for portal:
Code:
<table width="100%" cellpadding="4" cellspacing="1" border="0" class="forumline" align="center">
<tr>
<th class="thTop" align="center">Tell you friends about us:</th>
</tr>
<tr>
<td class="row1" align="center">
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin



var initialsubj="Great Site for You to Check Out"
var initialmsg="Hi:\n You may want to check out this site: "+window.location
var good;
function checkEmailAddress(field) {

var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.sex)|(\.biz)|(\.aero)|(\.coop)|(\.museum)|(\.name)|(\.pro)|(\..{2,2}))$)\b/gi);
if (goodEmail) {
good = true;
}
else {
alert('Please enter a valid address.');
field.focus();
field.select();
good = false;
   }
}
u = window.location;
function mailThisUrl() {
good = false
checkEmailAddress(document.eMailer.email);
if (good) {

//window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+document.title+" "+u;
window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+initialmsg
   }
}
//  End -->
</script>


<form name="eMailer">
<span class="gensmall">Tell a friend:</span>
<input class="formtextbox" type="text" name="email" size="26" value="     Enter Friends Email Here" onFocus="this.value=''" onMouseOver="window.status='Enter email address here and tell a friend about this site...'; return true" onMouseOut="window.status='';return true">
<br>
<input class="formbutton" type="button" value="Send this URL" onMouseOver="window.status='Click to send an email (with this page address) to a friend! Enter email address above...'; return true" onMouseOut="window.status='';return true" onClick="mailThisUrl();">
</form>
</td>
</tr>
</table>


code to add to templates css file:
Code:
.formtextbox {
   border: 1px solid #FF0000;
   color: #FFFFFF;
   background: inherit;
}

.formbutton {
   margin-top:2px;
   border: 1px solid #FF0000;
   color: #FFFFFF;
   background: inherit;
}

please note you can change the border color and text color, the background in transparent, that can also be changed.
symon

Symon wrote:
Nudge Wink


Cheers nick but i meant nudge for Admin on the original question.
myff admin

I am a bit confuzzled by the first post

As the POST/GET variable TO can be used to set a delivery address, if not given this will default to the admin address.
symon

When you type in the email address of your friend , it will then open up your default eamil program for example yahoo, msn,google

What i,m asking is how to make it use the forum email program.
myff admin

I guess my question there would be why? There seems no advantage.
symon

fair point but the finished portal i was hoping would be you enter email click send you then receive a pop up[ box thanking you for sending the link , just thought it might be a neater way of doing it , rather than just send them off to their email client and that's that.

Could the emailer portal not be adapted to suit this need or would this as you say be alot of hassle for a fancy extra ?
myff admin

It would be quite easy:

Code:

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin



var initialsubj="Great Site for You to Check Out"
var initialmsg="Hi:\n You may want to check out this site: "+window.location
var good;
function checkEmailAddress(field) {

var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.sex)|(\.biz)|(\.aero)|(\.coop)|(\.museum)|(\.name)|(\.pro)|(\..{2,2}))$)\b/gi);
if (goodEmail) {
good = true;
}
else {
alert('Please enter a valid address.');
field.focus();
field.select();
good = false;
   }
}
u = window.location;
function mailThisUrl() {
good = false
checkEmailAddress(document.eMailer.TO);
if (good) {

document.eMailer.submit();
   }
}
//  End -->
</script>


<form name="eMailer" action="

http://forum.myfreeforum.org/viewportal.php?component=emailer">
Tell a friend:
<input type="text" name="TO" size="26" value="     Enter Friends Email Here" onFocus="this.value=''" onMouseOver="window.status='Enter email address here and tell a friend about this site...'; return true" onMouseOut="window.status='';return true">
<br>
<input type="button" value="Send this URL" onMouseOver="window.status='Click to send an email (with this page address) to a friend! Enter email address above...'; return true" onMouseOut="window.status='';return true" onClick="mailThisUrl();">
</form>


would be close.
symon

1 problem here.

Doing that will send all emails to the forum admin only which defeats the object as the mailer is set up to auto send to the admin or forum email addy.
myff admin

Not so, or at least should not be, as the code should pass TO to the emailer and send to that address.
symon

Sorry every time i have tried i just a blank email which is my thought as i havnt set the label for= yet but each email goes to the forums default eamil and not the one i,m trying to send to.

link is

http://testhtml.myfastforum.org/final.html

now if you try this it still comes to the admin email not the one you are trying to send to.
myff admin

Well SUBJECT/MESSAGE also need to be input fields on the form.
and we probably need method="POST" in the form tag.
I should have thought of that, but I forget GET variables won't work here.
symon

Been thinking more on this and think i,ll leave it to outside email, as having the link there using forum email could lead to problems as the admin would have no control over abuse or spam by rouge members.

       myfreeforum.org Forum Index -> Portal components
Page 1 of 1
Create your own free forum | Buy a domain to use with your forum