Page Index Toggle Pages: 1 Print
Send to Friend - Mail Source Change (Read 3804 times)
Captain John
Ex Member


Send to Friend - Mail Source Change
Feb 27th, 2008 at 4:18pm
Print Post  
As designed the "Send to Friend" sends email out over the server. To change this to use users email client, modify the file Sources/Display.pl.,  this will auto insert the text of YaBB's "Send to a friend"-email in the subject and in the body of the mail. The user needs only to fill in the address and name of the person to whom the mail goes to and then he can send the mail out on his own email-account.


In Display.pl (Revision 1.60.2.15):

Search for:
Code
Select All
$template_sendtopic = qq~$menusep<a href="$scripturl?action=sendtopic;topic=$viewnum">$img{'sendtopic'}</a>~;
 




Replace with:
Code
Select All
$template_sendtopic = qq~$menusep<a href="javascript:sendtopicmail();">$img{'sendtopic'}</a>~; 






Add after line 892 (UnMODded Script) all highlited text:

Code
Select All
$display_template =~ s/({|<)yabb forumselect(}|>)/$selecthtml/g;

&LoadLanguage('SendTopic');
&LoadLanguage('Email');
require "$sourcedir/Mailer.pl";
my $emessage = &template_email($sendtopicemail, {'toname' => '?????', 'subject' => $msubthread, 'displayname' => $username, 'num' => $viewnum});
$emessage = &uri_escape($emessage);
my $esubject = "$sendtopic_txt{'118'}: $msubthread ($sendtopic_txt{'318'} $username)";
$esubject = &uri_escape($esubject);

##############################################################################
# $Id: Escape.pm,v 3.28 2004/11/05 13:58:31 gisle Exp $			    #
##############################################################################
# original at: http://search.cpan.org/~gaas/URI-1.35/URI/Escape.pm
my %escapes;

sub uri_escape {
		   my $text = shift;
		   return undef unless defined $text;
		   if (!%escapes) {
			 # Build a char->hex map
			 for (0..255) { $escapes{chr($_)} = sprintf("%%%02X", $_) }
		   }
		   # Default unsafe characters.  RFC 2732 ^(uric - reserved)
		   $text =~ s/([^A-Za-z0-9\-_.!~*'()])/$escapes{$1} || _fail_hi($1)/ge;
		   $text;
}
#################
# End Escape.pm #
#################

$yymain .= qq~
	 $display_template
	 <s c r i p t ....>
	 <!-- //

	 function uncheckAllBut(counter) {
		   for (var i = $start; i < $counter; i++) {
				if(i == counter) { document.forms["multidel"].elements["del"+i].checked = true; }
			     else { document.forms["multidel"].elements["del"+i].checked = false; }
		   }
		   document.multidel.submit();
	 }

	 function sendtopicmail() {
		   window.location.href = "mailto:?subject=$esubject&body=$emessage";
	 }

	 $pageindexjs
	 function ListPages(tid) { window.open('$scripturl?action=pages;num='+tid, '', 'menubar=no,toolbar=no,top=50,left=50,scrollbars=yes,resizable=no,width=400,height=300'); }
	 // -->
	 </s c r i p t>
	 ~;
	 &ToChars($msubthread);
	 $yytitle = $msubthread;
	 &template;
	 exit; 





by user deti
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Print
 
  « Board Index ‹ Board  ^Top