hello....
is javascript works in mailbody?
i mean admin sends registration form through email to new users. for that registration form validation javascript is not working. any suggestions

Recommended Answers

All 9 Replies

mail through intranet or internet...

nobody allows scripts to function in email,
malware
send an email link to the form online,

What Bob says, plus ......

Typically, registration validation emails are in plain text and include a hyperlink which is displayed in a clickable form by most modern email clients (some of which may allow this feature to be turned off).

No Javascript is necessary. The hyperlink will contain all the information necessary to validate the registration.

Airshow

nobody allows scripts to function in email,
malware
send an email link to the form online,

you have any idea about validation in the user mail ?

1)i know the one solution what it is means form action redirects to my webpage with values. if it redirect null values then i will redirects to restration form in my website.
2) another solution is create hyperlink and redirect to direct registration form which is in website.

i know these things. but i want to use javascript or any thing for validation in usermail . is it possible ?

<?
ob_start();
extract($_REQUEST);
include("includes/class.phpmailer.php");


if($_POST)
{
/////////////////////////////////////////////////////////////////////////////////////////////
///////             send registrationform to user          /////////
///////////////////////////////////////////////////////////////////////////////////////////

	
		
		
$sitename="http://localhost/murali/";
	
		//this subject will be visible only for you
		$sub = "".$name." invites you to www.murali.com";
	
		$msg = "<html><head>
		<script>
		function valide()
		{
		if(document.formz.username.value=='')
		{
		alert('enter username');
		document.formz.username.focus();
		return false;
		}
		if(document.formz.password.value=='')
		{
		alert('enter password');
		document.formz.password.focus();
		return false;
		}
		else
		{
		window.document.formz.action='http://localhost/murali/';
		}
		}
		</script>
		
		
		</head>
		
		<body>
		<table width='100%'  border='0' cellspacing='0' cellpadding='0'>
					  <tr>
						<td height='8'></td>
					  </tr>
					  <tr>
						<td style='font-family:Verdana; font-size:12px; font-weight:normal; color:#000000' align='left'>
							<br>
							
							    <p>".$transl2." </p><br>
								
								<form name='formz' action='' method='post' onsubmit='return valide();'>
								<table align='center'>
								<tr>
								<td>username</td>
								<td><input type='text' name='username'></td>
								</tr>
								<tr>
								<td>password</td>
								<td><input type='password' name='password'></td>
								</tr>
								<tr>
								<td>Address</td>
								<td><input type='address' name='address'></td>
								</tr>
								<tr>
								<td>&nbsp;</td>
								<td><input type='submit' name='submit' value='submit' ></td>
								</tr>
								</table>
								</form>
									</td>
					  </tr>
					  
					  
					  <tr>
						<td height='8'></td>
					  </tr>
					  <tr>
						<td height='8'></td>
					  </tr>
					 
					  <tr>
						<td height='8'></td>
					  </tr>
					  <tr>
						<td align='left' style='font-family:Verdana; font-size:12px; font-weight:bold; color:#47493F'>Regards,<br>
						murali.
						</td>
					  </tr>
					  <tr>
						<td height='8'></td>
					  </tr>
					  <tr>
						<td height='8'></td>
					  </tr>
					   
					  
					  
					  <tr>
						<td height='4'></td>
					  </tr>
					</table></body>
					</html>";
			
			$msg = stripslashes($msg);
			
			
			
			//include("includes/class.smtp.php");
			//include("includes/constants.php");
		
			$SmtpAuth = 1; // 1 For IsSMTP() and 0 For IsMail()	
			
			$mail = new PHPMailer();
			
			//$mail->IsMail();
			if($SmtpAuth == 0)
			{
				$mail->IsMail();
			} 
			else 
			{
				$mail->IsSMTP();
				$mail->Host = "xxxx";  // specify main and backup server
				$mail->SMTPAuth = true;     // turn on SMTP authentication
				$mail->Username = "xxxx";  // SMTP username
				$mail->Password = "xxxx"; // SMTP password
			}                                      // set mailer to use SMTP
			
			
			
				$mail->From     = $_POST[email];
				$mail->FromName = $_POST[name];
				$mail->AddAddress($_POST[useremail]);
/*				$mail->AddCC($resNewsUsers["emailid"]);
				$mail->AddBCC($resNewsUsers["emailid"]);*/
				$mail->IsHTML(true);                                  // set email format to HTML
				$mail->Subject = $sub;
				$mail->Body = $msg;
				$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
				$mail->Send();
			
		$send=1;
/////////////////////////////////////////////////////////////////////////////////////////////
///////            end          /////////
///////////////////////////////////////////////////////////////////////////////////////////

}
?>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
   
  </head>
  <body>
  <form name="formx" method="post">
  <center>you can send mails in any languages</center>
 
  <? if($send==1)
  {
  ?>
  successfully sent.
  <?
  }
  ?>
  
     

<br>
name:    
<input type='textbox' id="name" name="name"/><br>
<br>
email:                                                                           
<input type='textbox' id="email" name="email"/><br>
<br>useremail:       <input type='textbox' id="useremail" name="useremail"/>
<br>Body<br>           <textarea id="transl2" name="transl2" style="width:600px;height:200px"></textarea>
	<input type="submit" name="submit" value="murali"></input>
    <br><div id="errorDiv"></div>
	</form>
  </body>
</html>

logicScripting is always blocked in email
the usual method is...end logic

Of course you can use javascript in the email
It won't work but
don't let total failure put you off
be different
alert "danger" messages in mail readers when the user opens automatically generated mail from your domain will get you heaps of extra traffic
wont get you black flagged
don't look like malware

what a **expletive deleted** head

logicScripting is always blocked in email
the usual method is...end logic

Of course you can use javascript in the email
It won't work but
don't let total failure put you off
be different
alert "danger" messages in mail readers when the user opens automatically generated mail from your domain will get you heaps of extra traffic
wont get you black flagged
don't look like malware

what a **expletive deleted** head

]
thanks. actually client requirement is like that. i dnt know how to do this task.

then please inform the client
the repercussions of script content in the email will be hugely negative
it may take a little convincing,itmay take a lot of convincing
plan for the worst hope for the best,
but they will never get script email past the settings on the users' end

then please inform the client
the repercussions of script content in the email will be hugely negative
it may take a little convincing,itmay take a lot of convincing
plan for the worst hope for the best,
but they will never get script email past the settings on the users' end

for this answer i got a bad reputation from my client.


he asked one question to me. ....why it is not possible. i saw it using in ".net". so why it is not possible in php?
then i have no answer to cover...........

IF it is .asp, then it is on a server, not email.
therefore the email links to a server page for validation (as described in prior posts in this thread)
Have the client show you the example they 'saw' of an email script
The client is asking for "something" , but what they intend is not what they say. One of the posters here has a great signature
"50% of finding the solution is describing the problem"What you ask (1) trying to develop what the client describes (2) of what somebody else is doing (3)
adds three levels where error can occur

Its a cave man describing a space shuttle,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.