nourahm Posted December 17, 2008 Share Posted December 17, 2008 Hello all, I'm testing a script for emailing my users "pre-made" emails which are stored in mysql database. I have it setup on cron for every hour. The emails are sent to users, however, instead of the email message showing in the message body, the email message body is empty and my message only shows as a "noname" file attachment. Headers work, subject works however, the body of the email is blank & to read the email, user has to download the attachment, and read html. My live emails work properly. Signup confirmation works properly, however, these newsletter/paid emails do not. this is my cron email.php <?php session_start(); include('../dbconnect.php'); include('../global.php'); $sq=mysql_query('SELECT * FROM setupinfo'); $ar=mysql_fetch_array($sq); @extract($ar); $query = mysql_query("SELECT * FROM users WHERE paidEmails = '1'"); $count = mysql_num_rows($query); if($count > 0) { for($i = 0;$i < $count;$i++) { mysql_data_seek($query, $i); $user = mysql_fetch_array($query); $q = mysql_query("SELECT * FROM reads WHERE fsize > freads ORDER BY RAND() LIMIT 0, 1"); $c = mysql_num_rows($query); if($c > 0) { $email = mysql_fetch_array($q); $message=$email['ftext']." \n Click this link to earn ".$email['fprise']." ".$email['fpaytype'].": \n ".$ptrurl."reademail.php?id=".$user['username']."&username=".$user['username']."&mailcode=".$email['fnum']."\n\n\n\n\nThis email was sent to you as a paid email because you are signed up as a free member at $ptrname. To stop receiving these, simply log into your account, click My Account and update your email settings to not receive paid email requests."; $subject=$email['fsubject']." - Paid email from $ptrname"; $headers="From: $adminemail\n"."Content-type: text/$mailformat; charset=$mail_coding"; $mail = @mail($user['femail'], $subject, $message, $headers ); if($mailer) { echo "<FONT COLOR=GREEN><STRONG>SUCCESS</STRONG></FONT> - Sending email to user.<BR>"; } else { echo "<FONT COLOR=RED><STRONG>FAILURE</STRONG></FONT> - Sending email to user.<BR>"; } echo "EMail : ".$user['email']."<BR>Message: ".$message."<BR>Subject: ".$subject."<BR><HR>"; } else { echo "Could not find a paid email to send to this user.<BR>"; } } } else { echo "There are no users set to receive paid emails at this time.<BR>"; } ?> Basically, I want the message to show in the body of the email, not as an attachment. Your help is greatly appreciated. Thanks! ??? Quote Link to comment https://forums.phpfreaks.com/topic/137354-php-emailer-issue-email-message-is-showing-as-an-attachment-not-in-email-body/ Share on other sites More sharing options...
Adam Posted December 17, 2008 Share Posted December 17, 2008 What do: $mailformat and $mail_coding equal ? A Quote Link to comment https://forums.phpfreaks.com/topic/137354-php-emailer-issue-email-message-is-showing-as-an-attachment-not-in-email-body/#findComment-717637 Share on other sites More sharing options...
nourahm Posted December 17, 2008 Author Share Posted December 17, 2008 What do: $mailformat and $mail_coding equal ? I have the options of sending text or html and 1 of 12 or so different languages at the time I create the email. So $mailformat is for the text or html and $mail_coding is for the languages. Quote Link to comment https://forums.phpfreaks.com/topic/137354-php-emailer-issue-email-message-is-showing-as-an-attachment-not-in-email-body/#findComment-717641 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.