function sendMsgNotif($from, $to, $id) { $username = "******"; $password = "******"; $hostname = "localhost"; $db = "comm"; $db = new mysqli($hostname, $username, $password, $db); $db->set_charset("utf8"); $name = $db->query("SELECT user FROM tblusers WHERE userId='" . $from . "'")->fetch_array(); for ($i = 0; $i < count($to); $i++) { $db->query("INSERT INTO tblnotif (notif,type,targetId,fromId,toId) VALUES ('Te han compartido un nuevo posteo','1','" . $id . "','" . $from . "','" . $to[$i] . "')"); sendNotifEmail($to[$i], $name['user'], 1, $id); } }
//Message $link = "http://comunidad.nitragin.com.ar/msg.php?id=" . $id; $text = "mensaje"; break; } $email = '<!DOCTYPE html ><html><body><meta http-equiv="Content-Type" content="text/html;charset=utf-8"/><center><table id="wrapper" width="600" cellspacing="0" cellpadding="0" border="0" ><tr><td style="padding:0px;border-collapse:collapse;font-family:Arial, Helvetica, sans-serif;text-align: center"><img style="border:0;height:auto;line-height:100%;outline:none;text-decoration:none;float:left;" width="600" height="67" src="http://comunidad.nitragin.com.ar/mailing/notif/img/header.png"/></a></td></tr><tr><td style="border-collapse:collapse;padding-right:31px;font-family:Helvetica, sans-serif;padding-top:25px;"><table style="margin:0;"><tr><td style="padding:0;padding-left:150px;border-collapse:collapse;font-family:Arial, Helvetica, sans-serif;text-align: center;padding-top:20px;" ><img width="44" height="44" src="http://comunidad.nitragin.com.ar/mailing/notif/img/msg.png"/ style="float:right;border:0;height:auto;line-height:100%;outline:none;text-decoration:none;"><br></td><td style="padding:0;border-collapse:collapse;font-family:Arial, Helvetica, sans-serif;text-align: center;padding-top:10px;"><p style="font-family:Helvetica, sans-serif;float:left;font-size:15px;color:#66686A;margin:0;mso-line-height-rule:exactly;line-height:13px;text-align: left;">' . $from . ' te ha compartido un nuevo posteo</p></td></tr></table></td></tr><tr><td style="border-collapse:collapse;font-family:Helvetica, sans-serif;text-align:center;padding-bottom:40px;"><table style="margin:0;"><tr><td style="padding:0;border-collapse:collapse;font-family:Arial, Helvetica, sans-serif;text-align: center;padding-left:240px;" ><a href="' . $link . '"><img src="http://comunidad.nitragin.com.ar/mailing/notif/img/more.png" width="53" height="20"></a></td></tr></table></td></tr><tr><td style="border-collapse:collapse;font-family:Helvetica, sans-serif;text-align:center;background-color:#3F2B3C"><table style="margin:0;"><tr><td style="padding:7px 0px;padding-left:20px;border-collapse:collapse;font-family:Arial, Helvetica, sans-serif;text-align: left;" ><img width="139" height="20" src="http://comunidad.nitragin.com.ar/mailing/notif/img/commL.png"/ style="float:right;border:0;height:auto;line-height:100%;outline:none;text-decoration:none;"><br></td></tr></table></td></tr></table></center><style type="text/css">table{font-family:Arial, Helvetica, sans-serif;border:0;}p{text-align:justify;}</style><style type="text/css">/* Client-specific Styles */#outlook a{padding:0;}/* Force Outlook to provide a "view in browser" button. */body{width:100% !important;}.ReadMsgBody{width:100%;}.ExternalClass{width:100%;}/* Force Hotmail to display emails at full width */body{-webkit-text-size-adjust:none;}/* Prevent Webkit platforms from changing default text sizes. *//* Reset Styles */body{margin:0px auto;padding:0;font-family:Arial, Helvetica, sans-serif;}img{border:0;height:auto;line-height:100%;outline:none;text-decoration:none;float:left;}</style></body></html>'; $subject = "Nueva notificacion en Nitragin Comunidad"; $fromM = "*****@*****.**"; $headers = "From:" . $fromM . "\r\n"; $headers .= "Reply-To:soporte@nitragin.com.ar\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; mail($to['user'], $subject, $email, $headers); } $username = "******"; $password = "******"; $hostname = "localhost"; $db = "comm"; $type = $_POST['postType']; $id = $_POST['postId']; if ($_POST['postType'] != "" && $_POST['postId'] != "") { $db = new mysqli($hostname, $username, $password, $db); $db->set_charset("utf8"); $name = $db->query("SELECT user FROM tblusers WHERE userId=" . $_SESSION['userId'] . "")->fetch_array(); mb_internal_encoding('UTF-8'); $to = $_POST['shareSel']; for ($i = 0; $i < count($to); $i++) { $db->query("INSERT INTO tblnotif (notif,type,targetId,fromId,toId) VALUES ('Te han compartido un nuevo posteo','" . $type . "'," . $id . "," . $_SESSION['userId'] . "," . $to[$i] . ")"); sendNotifEmail($to[$i], $name['user'], $type, $id); } }