Tag Archive for email

Actionscript email validation

	function is_valid_email(email:String):Boolean
{
var emailRgx:RegExp = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
///^[a-zA-Z0-9][-._a-zA-Z0-9]*@([a-zA-Z0-9]*.)+[a-zA-Z]{2,6}$/;
trace(emailRgx.test(email));
return emailRgx.test(email);
}
is_valid_email("c@j.co");

source

Check validation email adres

function is_valid_email($email)
{
if(preg_match("/[a-zA-Z0-9_-.+]+@[a-zA-Z0-9-]+.[a-zA-Z]+/", $email) > 0)
return true;
else
return false;
}

source

Email this page

<SCRIPT LANGUAGE="JavaScript">
<!-- Original:  Ronnie T. Moore -->
<!-- Web Site:  The JavaScript Source -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! <a href="http://javascript.internet.com" >http://javascript.internet.com</a> -->

<!-- Begin
function initMail(form) {
text = "Check out this page:  " + window.location;
form.message.value = "Hi " + form.sendto.value + " (" + form.to.value + "):

"
+ text + "

Your Friend,
" + form.sendername.value + "(" + form.senderemail.value + ")";
return (form.to.value != "");
}
//  End -->
</script>

//////////////////////////////////////////////////////////////////////////////
//include this form content to pages that you may want to show.

<center>
<form name=emailform method=post action="http://cgi.freedback.com/mail.pl" target="_new" onSubmit="return initMail(this);">
<input type=hidden name=subject value="** Check Out This Site! **">
<input type=hidden name=message value="">
<table>
<tr><td colspan=2 align=center>Tell a friend about this page!</td></tr>
<tr><td>Their Name:</td><td><input type=text name=sendto></td></tr>
<tr><td>Their Email:</td><td><input type=text name=to></td></tr>
<tr><td>Your Name:</td><td><input type=text name=sendername></td></tr>
<tr><td>Your Email:</td><td><input type=text name=senderemail></td></tr>
<tr><td colspan=2 align=center><input type=submit value="Ok!"></td></tr>
</table>
</form>
</center>

source

Send Email Attachment from the Command Line

(echo "This is your message body";uuencode yourfile.ext yourfile.ext)|mail -s "Hello World!" <a href="mailto:email@domain.com">email@domain.com</a>

source

Send An Email Message

from smtplib import SMTP
DEF_FROM = 'me@example.com'
DEF_SMTP_SERVER = 'localhost'

class SENDMAILError:

def __init__( self, error ):
self.error = error

def __repr__( self ):
return self.error

def sendmail( toaddrs, msg, subject=None, fromaddr=DEF_FROM, smtpServer=DEF_SMTP_SERVER ):
"""Send an email to the given addresses"""

if smtpServer is None:
smtpServer = 'localhost'

if type( toaddrs ) is StringType:
toaddrs = toaddrs.split()
elif not type( toaddrs ) is ListType:
raise SENDMAILError( "toaddrs must be a string or a list" )

try:
headers = ("From: %s
To: %s

"
% ( fromaddr, ", ".join( toaddrs ) ) )
if not subject is None:
headers = "Subject: %s
" % subject + headers

server = SMTP( smtpServer )
server.sendmail( fromaddr, toaddrs, headers + msg )
server.quit()
except Exception, e:
raise SENDMAILError( str( e ) )

source

Encode Email against spammers

function encode_email($e)
{
for ($i = 0; $i < strlen($e); $i++) { $output .= '&#'.ord($e[$i]).';'; }
return $output;
}

source

ultimate validate email function

<?php

function validateEmail($email)
{
$isValid = true;
$atIndex = strrpos($email, "@");
if (is_bool($atIndex) && !$atIndex)
{
$isValid = false;
}
else
{
$domain = substr($email, $atIndex+1);
$local = substr($email, 0, $atIndex);
$localLen = strlen($local);
$domainLen = strlen($domain);
if ($localLen < 1 || $localLen > 64)
{
// local part length exceeded
$isValid = false;
}
else if ($domainLen < 1 || $domainLen > 255)
{
// domain part length exceeded
$isValid = false;
}
else if ($local[0] == '.' || $local[$localLen-1] == '.')
{
// local part starts or ends with '.'
$isValid = false;
}
else if (preg_match('/../', $local))
{
// local part has two consecutive dots
$isValid = false;
}
else if (!preg_match('/^[A-Za-z0-9-.]+$/', $domain))
{
// character not valid in domain part
$isValid = false;
}
else if (preg_match('/../', $domain))
{
// domain part has two consecutive dots
$isValid = false;
}
else if
(!preg_match('/^(\.|[A-Za-z0-9!#%&`_=/$'*+?^{}|~.-])+$/',
str_replace("\","",$local)))
{
// character not valid in local part unless
// local part is quoted
if (!preg_match('/^"(\"|[^"])+"$/',
str_replace("\","",$local)))
{
$isValid = false;
}
}
if ($isValid && !(checkdnsrr($domain,"MX") || checkdnsrr($domain,"A")))
{
// domain not found in DNS
$isValid = false;
}
}
return $isValid;
}

?>

source

link

<?php
function encode_mailto($mail, $label, $subject = "", $body = "") {
$chars = preg_split("//", $mail, -1, PREG_SPLIT_NO_EMPTY);
$new_mail = "<a href="mailto:";
foreach ($chars as $val) {
$new_mail .= "&#".ord($val).";";
}
$new_mail .= ($subject != "" && $body != "") ? "?subject=".$subject."&body=".$body : "";
$new_mail .= "">".$label."</a>";
return $new_mail;
}
?>

source

Validate Email

function validate_email($email)
{
return preg_match("/^[-_a-z0-9'+*$^&%=~!?{}]++(?:.[-_a-z0-9'+*$^&%=~!?{}]+)*+@(?:(?![-.])[-a-z0-9.]+(?<![-.]).[a-z]{2,6}|d{1,3}(?:.d{1,3}){3})(?::d++)?$/iD",$email);
}

source

JavaScript – is_valid_email

function is_valid_email (email)
{
return /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/.test(email);
}

source