Archive for 'email'


Inviare emails tramite SMTP con PHPmailer e Gmail

Posted on 19. Sep, 2009 by daniele.

1

 
 
define('GUSER', 'you@gmail.com'); // Gmail username
define('GPWD', 'password'); // Gmail password
 
function smtpmailer($to, $from, $from_name, $subject, $body) {
	global $error;
	$mail = new PHPMailer();  // create a new object
	$mail->IsSMTP(); // enable SMTP
	$mail->SMTPDebug = 0;  // debugging: 1 = errors and messages, 2 = messages only
	$mail->SMTPAuth = true;  // authentication enabled
	$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for Gmail
	$mail->Host = 'smtp.gmail.com';
	$mail->Port = 465;
	$mail->Username = GUSER;
	$mail->Password = GPWD;
	$mail->SetFrom($from, $from_name);
	$mail->Subject = $subject;
	$mail->Body = $body;
	$mail->AddAddress($to);
	if(!$mail->Send()) {
		$error = 'Mail error: '.$mail->ErrorInfo;
		return false;
	} else {
		$error = 'Message sent!';
		return true;
	}
}
 
//esempio applicato
 
if (smtpmailer('to@mail.com', 'from@mail.com', 'yourName', 'test mail message', 'Hello World!')) {
	// do something
}
if (!empty($error)) echo $error;
 

Continue Reading

Convertire un indirizzo e-mail da una stringa in un link

Posted on 03. Aug, 2009 by daniele.

0

 
< ?php
function convert_emails_to_clickable_links($text)
{
$regex = "([a-z0-9_\-\.]+)". # name
 
"@". # at
 
"([a-z0-9-]{1,64})". # domain
 
"\.". # period
 
"([a-z]{2,10})"; # domain extension 
 
$text = eregi_replace($regex, '<a href="mailto:\\1@\\2.\\3">\\1@\\2.\\3', $text);
 
return $text;
}
 
$text = 'You can contact me at: example-name@mysite.com. My alternative address is other-username@domain.com.';
 
echo convert_emails_to_clickable_links($text);
 
/*
You can contact me at: <a href="mailto:example-name@mysite.com">example-name@mysite.com</a>. My alternative address is <a href="mailto:other-username@domain.com">other-username@domain.com</a>.
?>
*/
 

Continue Reading

Ricevere le email di Gmail con PHP, MooTools e IMAP!

Posted on 21. Jul, 2009 by daniele.

0

Codice CSS:

 
div.toggler { border:1px solid #ccc; background:url(gmail2.jpg) 10px 12px #eee no-repeat; cursor:pointer; padding:10px 32px; }
 
div.toggler .subject { font-weight:bold; }
 
div.read { color:#666; }
 
div.toggler .from, div.toggler .date { font-style:italic; font-size:11px; }
 
div.body { padding:10px 20px; }
 

Codice MooTools:

 
window.addEvent('domready',function() {
var togglers = $$('div.toggler');
if(togglers.length) var gmail = new Fx.Accordion(togglers,$$('div.body'));
togglers.addEvent('click',function() { this.addClass('read').removeClass('unread'); });
togglers[0].fireEvent('click'); //first one starts out read
});
 
Codice PHP:
 
 
/* connect to gmail */
$hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
$username = 'tuaemail@gmail.com';
$password = 'passwordtuaemail';
/* try to connect */
$inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error());
/* grab emails */
$emails = imap_search($inbox,'ALL');
/* if emails are returned, cycle through each... */
if($emails) {
/* begin output var */
$output = '';
/* put the newest emails on top */
rsort($emails);
/* for every email... */
foreach($emails as $email_number) {
/* get information specific to this email */
$overview = imap_fetch_overview($inbox,$email_number,0);
$message = imap_fetchbody($inbox,$email_number,2);
/* output the email header information */
$output.= '
<div class="toggler '.($overview[0]->seen ?…

Continue Reading

MyOutlook

Posted on 06. Apr, 2009 by Administrator.

0

MyOutlook is a program written in PHP adopted Microsoft Outlook function: webmail, task and event organizer and contact address management

Link: http://sourceforge.net/projects/myoutlook/

Continue Reading

phpop3clean based spam e virus filtering POP3 email accounts

Posted on 28. Dec, 2008 by Administrator.

0

phpop3clean è un filtro per spam & virus/worm per POP3 email account. Disegnato per girare come un cron job e catch spam basato su links a blacklisted IPs, parole offuscate o blacklisted fresi; attached-image spam; email worms; corrupted or malformed emails.

Sito web: http://sourceforge.net/projects/phpop3clean/

Continue Reading