-
Posts
149 -
Joined
-
Last visited
Never
Everything posted by IrOnMaSk
-
you don't have to buy a program just to do that... ahahaha! why not!!!! just kidding if you really want it, the simplest way is to manually enter the info into the db. Otherwise, I don't think people feel comtable to help you do that!!!
-
cunoodle, I found this code online. It will send out email with attachment and I tested it, and worked fine!!! You might run into a path issue if you don't give the correct path which will result in an empty file attachment... so just watch out for that. Here's the code... <?php function mail_attachment($filename, $path, $mailto, $from_mail, $from_name, $replyto, $subject, $message) { $file = $path.$filename; $file_size = filesize($file); $handle = fopen($file, "r"); $content = fread($handle, $file_size); fclose($handle); $content = chunk_split(base64_encode($content)); $uid = md5(uniqid(time())); $name = basename($file); $header = "From: ".$from_name." <".$from_mail.">\r\n"; $header .= "Reply-To: ".$replyto."\r\n"; $header .= "MIME-Version: 1.0\r\n"; $header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n"; $header .= "This is a multi-part message in MIME format.\r\n"; $header .= "--".$uid."\r\n"; $header .= "Content-type:text/plain; charset=iso-8859-1\r\n"; $header .= "Content-Transfer-Encoding: 7bit\r\n\r\n"; $header .= $message."\r\n\r\n"; $header .= "--".$uid."\r\n"; $header .= "Content-Type: application/octet-stream; name=\"".$filename."\"\r\n"; // use different content types here $header .= "Content-Transfer-Encoding: base64\r\n"; $header .= "Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n"; $header .= $content."\r\n\r\n"; $header .= "--".$uid."--"; if (mail($mailto, $subject, "", $header)) { echo "mail send ... OK"; // or use booleans here } else { echo "mail send ... ERROR!"; } } $my_file = "something.zip"; $my_path = $_SERVER['DOCUMENT_ROOT']."/your paht here/"; $my_name = "your name"; $my_mail = "[email protected]"; $my_replyto = "[email protected]"; $my_subject = "This is a mail with attachment."; $my_message = "Hallo,\r\ndo you like this script? I hope it will help.\r\n\r\ngr. Olaf"; mail_attachment($my_file, $my_path, "[email protected]", $my_mail, $my_name, $my_replyto, $my_subject, $my_message); ?> So just give the right path to your backup file... that should do... Here's the source code: http://www.finalwebsites.com/forums/topic/php-e-mail-attachment-script goodluck!
-
well since the satisfaction is determined solely at my own digression, then i say, it's not yet been solved satisfactorily!!! hehe well, i don't wanna be warned, or baned, or IOM so i'ma mark it as solved!!!
-
It certainly would ;P Yep, and there is actually some ongoing staff deliberation on how to improve this issue. oh kk nice, that's awesome
-
ouchie spicy... maybe i used the wrong word... when i wrote enforced I was thinking more like reminding... I didn't mean to make it looks like you guys haven't done enough, it's completely the opposite... Hey Maq that would be a one heckic super complex script to write, wouldn't it!!! But I do realize that the responsibility totally rested on the author of the post to decide whether the question has recieved a 'satisfaction anwer' and then close. I thought a friendly reminder would help because we do forget when we got the answer to the question to close the post and there's no reason for warning or ban or IOM cuz that's just stupid. And AK47, thanks for the suggestion, how do I do that?
-
hi, I've been looking at many posts. I've found that lots of them been answered but they are still open and somewhat is wasting time of the people who want to help thinking the posts have not been answer. I wonder (it might already been in place) if there some sort of enforcing authors to close the post after getting answer to the problem??? hehehe......... thanks
-
Cunnoodle, You can use cron sendmail to accomplish this without the php part... look here: http://www.linuxquestions.org/questions/linux-newbie-8/send-email-txt-attachment-using-cron-job-43492/ or use the php mail function, just little more complicated... look here : http://www.dreamincode.net/forums/topic/24215-php-mail-attachment/ then use the cron to execute the task... ps. i didn't test this... I use windows sendmail, to do the email with attachment... here: http://www.makeuseof.com/tag/send-automated-emails-save-time-sendemail-windows-task-scheduler/ but i'm guessing you're using linux :'( goodluck!!!
-
thax for the advice premiso
-
hehe, did some research, I opened my eyes, then I saw!!! maybe I haven't code enough to see the efficiency or the effectiveness of coding that way... but sure pranshu82202 you can put the html coding in the the ECHO... works just find... I just really seen...
-
hehe, which part of AbraCadaver's code is the HTML Tag INSIDE the PHP Tag? I was talking about this <?php <html>blabla</html ?>
-
never seen html tag inside php tag, most like it's the other way around... maybe give just little bit more explaination of what you're trying to do... will be happy to help
-
thankz gizmola, i'ma try see what happens!!! i'll close this post after i get the result
-
hey Anks, may I ask whose webpage that is? lol ... and what do you want to do after you store the page inside a variable? I have similare problem and able to solved this this way $file = file_get_contents ('path to webpage', true); If that doesn't work, write the webpage content to file first, then open it and do the file get content, this will definitly work... let me know
-
Hi guys, I using the mail function... And just wonder if it has the capability of sending mail to a distrubtion list like #[email protected] ... and it that distribution list is another distriution like #[email protected]... Can someone assure me that mailing function will send out to the members in the list even with the # in front of the address? I don't want to test it because it will be lots of receptients who might get annoy of a testing emails... thanks,
-
thanks, Abra for the reply... It works perfectly...
-
Hi guyz, so I'm using preg_match to find a certain phrase in a file. Here's the code $file = file_get_contents ('content.html', true);//get content from file for reading if (preg_match('/Application/',$file)) { email('[email protected],$file); echo 'email sent'; } so the code above works fine. But how do I find word with the forward slash "/" in it? Is it even possible? Like: $file = file_get_contents ('content.html', true);//get content from file for reading if (preg_match('/Application/Software/',$file)) { email('[email protected],$file); echo 'email sent'; } This will give me an error (Unknown Modifier 'S') Any Idea is appriciated!!! Thanks
-
Hey Garteth your question is a bit confusing the error code has nothing to do with your connection to the database. your mysql_query is giving you the error. So if you want to use the require once or the include for you connection... you need to put this code mysql_connect ("#####", "#####","######") or die (mysql_error()); mysql_select_db("#####"); in connect.php file... and at the top of your query code include it or require the file there, then you don't have to keep writing the detail connection to the database... concerning the error, recheck your mysql_query statement.... goodluck
-
export php page to a file (excel or pdf)
IrOnMaSk replied to houssam_ballout's topic in PHP Coding Help
is your output going to be display as webpage? one of the best ways is do the read/write to file if you only need specific data from the table... select the data then write it to file... Super simple instruction here, might just do the trick http://www.w3schools.com/php/php_file.asp goodluck -
Sending email wtih mysql qurey result on body
IrOnMaSk replied to phpme1221's topic in PHP Coding Help
Hey 1221, I tested this code and it sent out to emails in database with specific info in the body of the email. I'm sorry I can't test your exact given info because i'm limited to only a certain outgoing mail servers. However, the code exact same. So here it is: <?php mysql_connect('localhost', 'root', '******') or die('could not connect: ' . mysql_error()); mysql_select_db("database") or die('cannot select the database'); ?> <html> <head> <title>create student table</title> <body> <?php $to = "'; $subject = 'email testing'; $message = "'; $message .= "<table border = 1>"; $message .= "<tr><th>Name</th><th>Email</th></tr>"; $query = "select Name, Email from info"; // adjust to your code $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)){ $message .= "<tr><td>"; $message .= $row['Name']; $message .= "</td><td>"; $to .= $row['Email']; $message .= $row['Email'] . "<br />"; $message .= "</table>"; //end email here // Always set content-type when sending HTML email $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; // More headers $headers .= 'From: <[email protected]>' . "\r\n";//i'm using my real address here to test $headers .= 'Cc: [email protected]' . "\r\n"; mail($to,$subject,$message,$headers); } ?> </body> </html> It works perfectly for me... make sure the addresses in the database are valid and enable the mailing port in php.ini If that's doesn't work for you, screw it lol -
Sending email wtih mysql qurey result on body
IrOnMaSk replied to phpme1221's topic in PHP Coding Help
Are you able to send out email using php mail function? Try giving it an email address in the $to without pulling from the database. Or try just using while loop to grab the address and send it without any info in it. $to = ''; $subject = 'email testing'; $message = 'see this?'; $query = "select Email from DATABASE"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)){ $to .= $row['Email'] //end email here $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; // More headers $headers .= 'From: <[email protected]>' . "\r\n"; $headers .= 'Cc: [email protected]' . "\r\n"; mail($to,$subject,$message,$headers); } See if that even works. If not you're having SMTP problem... -
Never Mind, I solved the problem. If anyone looking for similar solution let me know <?php echo "I\'m Neo"; Echo "Or The ONE"; ?> </php]
-
Sending email wtih mysql qurey result on body
IrOnMaSk replied to phpme1221's topic in PHP Coding Help
So, let say you want to send data in the hostname table in the email body... $to = "";//will send to the email you select from the database $subject = "whatever";//you can write whatever the subject is in here $message = "";//will be the html table with hostname data $message .= "<table border = 0>"; echo "<table border = 0>"; echo "<tr><th>HostName</th></tr>;//If you want to send more data create another columns for it... $message .= "<tr><th>HostName</th><th>Email</tr>"; //select your data $sql = mysql_query("SELECT Email,PrimaryContact,Hostname FROM sm_table WHERE NewSetDate='2011-07-01' ORDER BY Hostname ASC"); //get all the rows while($row2 = mysql_fetch_array($sql) or die(mysql_error())) { echo "<tr><td>"; $message .= "<tr><td>"; echo $row['HostName'];//assuming HostName is the column you want to grab data from $message .= $row['HostName']; echo "</td><td>"; $message .= "</td><td>"; echo $row['Email']; $to .= $row['Email']; echo "</td></tr>"; echo "</table>"; $message .= "</table>"; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; // More headers $headers .= 'From: <[email protected]>' . "\r\n"; $headers .= 'Cc: [email protected]' . "\r\n"; mail($to,$subject,$message,$headers); } Ok, that works for me sending data in the body to the email address in the database......... check the code i might miss something..... goodluck -
Sending email wtih mysql qurey result on body
IrOnMaSk replied to phpme1221's topic in PHP Coding Help
hey, you have to create a html table before you your select and fetch array, then pass your result into the table... get it? like create table columns with host name, server, ...etc then put your $row into the columns like echo $row['Host'] and watever you need... srry this is kinda a quick and confusing,,, let me know if you need code for that. i got mine to work with similar stuff you're doing... -
Hi, guys not sure if this is the right place for php-mysql help. So, I've been search for 2 weeks now how to send a query result in an email. I know how to do a simple putting the query into a html table and send it using $message .= blablabla. but what i'm looking for is little bit complicated. Any of you looking for a challenge, I promise this will be a challenge (I hope!!!). So I have a table function and call it every time I need to use it rather than create table and <tr><td> and put it into the message body. I don't know how to put the table function into the message body and send through email. here's the code: <?php function viewtable($result) { include 'opendb.php'; if ($conn) { echo "<table border=\"0\" border-width=\"thin\" valign=\"top\" cellspacing=\"3\" cellpadding=\"3\" width=\"100%\"><tr>"; //print field name $colName = odbc_num_fields($result); for ($j=1; $j<= $colName; $j++) { if (odbc_field_name($result,$j) != "App_ID") { echo "<th align=\"left\">"; echo odbc_field_name ($result, $j ); echo "</th>"; } } //fetch the data from the database while(odbc_fetch_row($result)) { echo "<tr align=\"left\">"; for($i=1;$i<=odbc_num_fields($result);$i++) { if (odbc_field_name($result,$i) == "App_ID") { $app = odbc_result($result,$i); } else { echo "<td align=\"left\">"; if (odbc_field_name($result,$i) == "Amount Due" || odbc_field_name($result,$i) == "Net Due") {echo "$";} echo odbc_result($result,$i); echo "</td>"; } } echo "<TD><br><form method = \"post\" action = \"app.php\">"; echo "<input type = \"hidden\" name = \"app\" value = $app>"; echo "<input type = \"submit\" value = \"View Application\"></form></TD>"; echo "</TR>"; } echo "</td> </tr>"; echo "</table >"; } else echo "odbc not connected"; } function useful_odbc_num_rows($result){ $num_rows=0; while($temp = odbc_fetch_into($result, $counter)) { $num_rows++; } @odbc_fetch_row($result, 0); // reset cursor return $num_rows; } ?> The rest is in the attachment... Challenging you, helping me I'm in the wrong place, have some grace and direct to the right one.... thanks in advance MOD EDIT: code tags added. [attachment deleted by admin]