include("Mail.php");
$host = "octeth.smtp.com";
$username = "";
$password = "";
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
Here is the content to be mailed
function MassMsgSMTPQ($mail_id,$ID,$ID2="")
{
global $site;
global $prof;
$subject = getParam($mail_id."_subject");
$text1 = getParam($mail_id);
$recipient1=$profile_des[Email];
$profile_des = db_arr("select NickName,ID from Profiles where email='$ID'");
$resUnReadMails = db_arr( "select count(*) from Messages where Recipient = '".$profile_des[ID]."' and New='1'");
$unread_mes = $resUnReadMails[0];
$text1 = str_replace( "<RealName>", $profile_des[NickName]."<br><br>", $text1);
$text1 = str_replace( "<UnreadMessages>", $unread_mes, $text1);
$text1 = str_replace( "<SiteName>", "http://www.kamaconnection.com", $text1);
$text1 = str_replace( "<Auto-generated e-mail, please, do not reply>", "Auto-generated e-mail, please, do not reply", $text1);
if($unread_mes)
{
$text1 = str_replace( "<TotalMessages>", $unread_mes, $text1);
}
if($ID2)
{
$text1 = str_replace( "<SenderName>", $ID2, $text1);
if($ID2!="Kama Connection Admin")
{
$res_to = db_arr("select id,email,nickname from Profiles where email='$ID'");
$res_from = db_arr("select id,email,nickname,picture,Pic_0_addon,DateOfBirth,Country,State from Profiles where nickname='$ID2'");
db_res("DELETE FROM ProfilesTrack WHERE Member = '".$res_to['id']."' AND Profile = '".$res_from['id']."'",0);
db_res("INSERT INTO ProfilesTrack SET Arrived = NOW(), Member = '".$res_to['id']."', Profile = '".$res_from['id']."'",0);
$recid = db_arr("SELECT MAX(ID) as MID from Messages where Recipient = '".$res_to[id]."' and Sender='".$res_from[id]."'");
$msgid=$recid[MID];
$text1="Dear";
$text1 .=' '.$res_to[nickname];
$text1 .=', <br>You got a new Message from ';
$text1 .= $res_from[nickname];
$text1 .="<BR><BR>";
$text1.="<table><TR>
<TD
height=36 align=left vAlign=top > </TD>
<TD class=Profile-tabtxt1 vAlign=top align=left
bgColor=#ffffff><TABLE
style=\"BORDER-RIGHT: #1351b7 1px solid; BORDER-TOP: #1351b7 1px solid; BORDER-LEFT: #1351b7 1px solid; BORDER-BOTTOM: #1351b7 1px solid; BACKGROUND-COLOR: #ffffff\"
cellSpacing=0 cellPadding=0 width=\"100%\" align=left
border=0>
<TBODY>
<TR>
<TD vAlign=center align=middle width=110 bgColor=#dbe9fe
rowSpan=4><IMG height=89
src=\"http://www.kamaconnection.com/id_img/";
if($res_from[Pic_0_addon]!='' && $res_from[picture])
{
$thumb_nail =$res_from[id]."_0_".$res_from[Pic_0_addon].".jpg";
}
else
{
$thumb_nail = "pic_not_avail.gif";
}
$text1 .=$thumb_nail;
$text1.="\" width=82></TD>
<TD vAlign=center align=middle bgColor=#dbe9fe
rowSpan=4> </TD>
<TD vAlign=center align=left width=120 bgColor=#dbe9fe
height=22>
<P
style=\"FONT-WEIGHT: normal; FONT-SIZE: 10px; COLOR: #666769; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif\"
align=left><SPAN
style=\"FONT-WEIGHT: bold; FONT-SIZE: 10px; COLOR: #666769; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif\">";
$text1 .=$res_from[nickname];
$text1.="</SPAN></P></TD>
</TR>
<TR>
<TD vAlign=center align=left bgColor=#dbe9fe
height=22><SPAN
style=\"FONT-WEIGHT: normal; FONT-SIZE: 10px; COLOR: #666769; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif\">Age:";
$text1 .= age($res_from['DateOfBirth']);
$text1 .="</SPAN></TD>
</TR>
<TR>
<TD vAlign=center align=left bgColor=#dbe9fe
height=22><SPAN
style=\"FONT-WEIGHT: normal; FONT-SIZE: 10px; COLOR: #666769; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif\">";
if($res_from[State])
$text1 .= $prof[$res_from[Country]][$res_from[State]].', ';
$text1 .= $prof[countries][$res_from[Country]];
$text1 .="</SPAN></TD>
</TR>
<TR>
<TD vAlign=center align=left bgColor=#dbe9fe
height=22> </TD>
</TR>
<TR>
<TD
style=\"FONT-WEIGHT: bold; FONT-SIZE: 10px; COLOR: #666769; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif\"
vAlign=center align=middle width=91
background=\"http://www.kamaconnection.com/cupid_mai ... g.jpg\"><A
href=\"http://www.kamaconnection.com/compose.p ... tr=".crypt( $res_to[email], 'secret_confirmation_string' )."&message=".$msgid."\" target=\"_blank\"><IMG
height=15 src=\"http://www.kamaconnection.com/cupid_mai ... il_but.jpg\"
width=43 border=0></A></TD>
<TD background=\"http://www.kamaconnection.com/cupid_mai ... mailbg.jpg\"
bgColor=#dbe9fe> </TD>
<TD width=91
background=\"http://www.kamaconnection.com/cupid_mai ... mailbg.jpg\"
bgColor=#dbe9fe>
<A href=\"http://www.kamaconnection.com/compose.p ... tr=".crypt( $res_to[email], 'secret_confirmation_string' )."&message=".$msgid."\" target=\"_blank\"><IMG
height=15
src=\"http://www.kamaconnection.com/cupid_mai ... ontact.jpg\"
width=91 border=0></A></TD>
</TR></table>
</TD></TR></table>";
}
}
$text2 = $text1;
$filename = "mails.htm";
$fd = fopen ($filename, "r") or die("Couldn't open file");
$message = fread ($fd, filesize ($filename));
//$message=addslashes($message);
//eval ("\$message = \"$message\";");
//$message=stripslashes($message);
$text1 = ereg_replace("#mailbody#",$text1,$message);
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: $site[title] <$site[email_notify]>";
$headers2 .= "-f$site[email_notify]";
$header .= "Return-path : bounces@kamaconnection.com";
$mail = $smtp->send($to, $headers, $body); (this is part that is not working.)
if (!mail($ID,$subject,$text1,$headers,$headers2)) return false;
return true;
}
?>
please help
hi need help with emailing script
Moderator: General Moderators
-
kamaconnection
- Forum Newbie
- Posts: 2
- Joined: Thu Apr 02, 2009 8:25 pm
Re: hi need help with emailing script
what problem you are facing exactly? kindly eloborate.
-
kamaconnection
- Forum Newbie
- Posts: 2
- Joined: Thu Apr 02, 2009 8:25 pm
Re: hi need help with emailing script
The problem I am having is what is correct syntax I need to use to send email. The one that is currently there is the default mail function . I want to use the smtp pear to send out the email that is $mail = $smtp->send($to, $headers, $body); instead of if (!mail($ID,$subject,$text1,$headers,$headers2)) return false;.
Thanks for your help.
Thanks for your help.