PHP - Php Mail Bounce Script
I have the need for a script that will "bounce" and email to a set number of users. I was told that this is possible with PHP but am not sure how to implement something like this. Here's a scenario:
I have an email, "all_users@example.com". When an email is sent to this address, "it" checks for all users and then sends that same email to all users. Now if I have a role called "Super User", and an email address called super_users@example.com, it would do the same as above except would send to only the addresses with role, "Super User". I have no clue where to start researching this and if it's even possible. Similar TutorialsHi, I have been trying to find an up-to-date bounce mail handler for PHP but so far everything I've found seems to be extremely dated. Two common suggestions are the bounce handler at http://www.phpclasses.org/package/2691-PHP-Parse-bounced-e-mail-message-reports.html , or the PHP Mailer-BMH, http://phpmailer.worxware.com/index.php?pg=bmh . I know for certain that PHP Mailer-BMH is dated and no longer a viable solution, and I believe the PHP classes solution is also dated. Does anyone know of a current bounce mail handler? Preferably it would include the functionality to connect to a remote mailbox so I won't have to do this myself. Thanks for any help. Hi, I need to check is the mail is sent and successfully deliver to the recipient email. here is the code : if(mail($to, $subject, $message, $headers, '-f ' . $return_path)) {echo "Sent"; }else {echo "Not Sent";} Please help me, its urgent. Thanks in advance. I have a notification system that notifies users of new comments, inside the email I have images, some of the logo, some of different people, everything shows up fine on my computer (yahoo email), however in the iPhones email application no images show up, there are just the blue squares with the question marks in them. I'm not sure what I'm missing. Code: [Select] $from = "Kithell <notifications@kithell.com>"; $headers = "From:" . $from ."\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $subject = name($from_id, 'fl').$action; $message = '<html><body> <style>@charset "utf-8"; /* CSS Document */ .e-container { background-color: #FFF;position: relative;width: 90%;min-height:1px;margin-right: auto;margin-left: auto; } .e-container .e-m-header { padding: 2px; background-image: url(http://www.kithell.com/assets/tall-grey-header.png); background-repeat: repeat-x; border: 1px solid #CCC; background-position: bottom; display: block; text-align: center; } .e-container p { font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; color: #666; vertical-align: text-top; display: inline-block; } .e-container .e-usr-photo { display: inline-block; margin: 10px; float: left; background-color: #F4F4F4; } .e-container p a { font-weight: bold; color: #3F60A3; text-decoration: underline; padding: 0px; float: left; margin-top: 0px; margin-right: 5px; margin-bottom: 0px; margin-left: 0px; } .e-container .e-quotes { font-size: 20px; font-weight: bold; color: #999; font-family: Tahoma, Geneva, sans-serif; display: block; padding: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 75px; margin-top:10px; } .e-container .e-message { font-size: 13px; color: #333; padding: 0px; margin-top: 0px; margin-right: 10px; margin-bottom: 0px; margin-left: 10px; clear: none; display: inline; }</style> <div class="e-container"><div class="e-m-header"><img src="http://www.kithell.com/assets/kithell-logo.png" /></div><img class="e-usr-photo" src="http://www.kithell.com/'.photo($from_id, 55).'" /><br /><p><a target="_blank" href="http://www.kithell.com/#/profile&id='.$from_id.'">'.name($from_id, "fl").' </a> '.$action.'<div class="e-quotes">"<p class="e-message">'.nl2br(htmlentities(stripslashes($message))).'</p>"</div></p></div></body></html>'; mail($to,$subject,$message,$headers); Hi, I'm developing a php newsletter software but I'm in trouble with bounce mails! I set a return path directing them into a specific email box then I read that email box with php and I process bounce mails to get the kind of problem. Well, I need to get some informations about those bounce emails: The name of the user that should recive that mail, the date when the mail has been sent, the kind of error encountered; It could be so easy if I could read the body of the mail I sent into the back bounce one but every server sends a different kind of bounce...for example mailer-daemon won't let me get the body of the sent message...how can I handle this? Andrea. This topic has been moved to Other Web Server Software. http://www.phpfreaks.com/forums/index.php?topic=347009.0 Hello, so I have input form for feedback with php mail send but i also want to send a sms message to user. This is html: <div class="fs-form-wrap" id="fs-form-wrap"> <form id="form" class="fs-form fs-form-full" action="#" method="post" autocomplete="off"> <ol class="fs-fields"> <li> <label class="fs-field-label fs-anim-upper" for=Name?</label> <input class="fs-anim-lower" id="q1" name="q1" type="text" placeholder="Name" required/> </li> <li> <label class="fs-field-label fs-anim-upper" for="q2" data-info="Vaild eamil....?</label> <input class="fs-anim-lower" id="q2" name="q2" type="email" placeholder="email@email.com" required/> </li> <li> <label class="fs-field-label fs-anim-upper" for="q3" data-info="Valid phone number">Phone number...?</label> <input onkeypress='return event.charCode >= 48 && event.charCode <= 57' class="fs-anim-lower" id="q3" name="q3" type="text" maxlength="10" placeholder="09x-xxx-xxxx" required/> </li> <li> <label class="fs-field-label fs-anim-upper" for="q4" data-info="What do you think about our servise?">Feedback</label> <textarea class="fs-anim-lower" id="q4" name="q4" placeholder="Feedback.."></textarea> </li> </ol><!-- /fs-fields --> <button class="fs-submit" type="submit" name="submit" id="send" >Send</button> </form> </div> This is php mail: <?php if(isset($_POST["submit"])){ //Checking for blank Fields.. if($_POST["q1"]==""||$_POST["q2"]==""||$_POST["q3"]==""||$_POST["q4"]==""){ echo "Fill everything.."; }else{ // Check if the "Sender's Email" input field is filled out $email=$_POST['q2']; // Sanitize e-mail address $email =filter_var($email, FILTER_SANITIZE_EMAIL); // Validate e-mail address $email= filter_var($email, FILTER_VALIDATE_EMAIL); if (!$email){ echo "Invalid Sender's Email"; } else{ $subject = $_POST['q3']; $message = 'Name: ' . $_POST['q1'] . ' Email: ' . $_POST['q2'] . ' Phone Number: ' . $_POST['q3'] . ' Feedback: ' . $_POST['q4']; $headers = 'From:'. $email . "\r\n"; // Sender's Email // message lines should not exceed 70 characters (PHP rule), so wrap it $message = wordwrap($message, 70); // Send mail by PHP Mail Function mail("myemail@mydomain.com", $subject, $message, $headers); echo "Thank you for feedback"; } } } ?> I have public sms getaway on my computer so when user input his phone script make link like this "http://mysmsgetaway....message-from-us" and it goes to my getaway.. Thank you I'd like to detect emails that hard bounce after i send out my newsletter, and then delete them from the table that stores them in my database. Any ideas? Thank you. I am testing my PHP script with post function to send emails,but the mail is not arriving in my inbox..?What may be the problem..? Code: [Select] <?php $ip = $_POST['ip']; $httpref = $_POST['httpref']; $httpagent = $_POST['httpagent']; $visitor = $_POST['visitor']; $visitormail = $_POST['visitormail']; $notes = $_POST['notes']; $attn = $_POST['attn']; #================================================================================================== #this looks for email if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,"."))) #================================================================================================== { echo "<h2>Use Back - Enter valid e-mail</h2>\n"; $badinput = "<h2>Feedback was NOT submitted</h2>\n"; echo $badinput; die ("Go back! ! "); } #================================================================================================== #this making sure all fields have been filled if(empty($visitor) || empty($visitormail) || empty($notes )) { #================================================================================================== echo "<h2>Use Back - Please fill in all fields</h2>\n"; die ("Use back! ! "); } #================================================================================================== #This is looking for captcha ====================================================================== session_start(); if ($_POST['captcha'] == $_SESSION['captcha']) #==================================================================================================== { $todayis = date("l, F j, Y, g:i a") ; $attn = $attn ; $subject = $attn; $notes = stripcslashes($notes); $message = " $todayis [EST] \n Attention: $attn \n Message: $notes \n From: $visitor ($visitormail)\n Additional Info : IP = $ip \n Browser Info: $httpagent \n Referral : $httpref \n "; $from = "From: $visitormail\r\n"; if ($attn == "Chairperson") mail("emailhere", $subject, $message, $from); if ($attn == "Securtary") mail("email here", $subject, $message, $from); if ($attn == "Treausure") mail("email here", $subject, $message, $from); if ($attn == "Training") mail("email here", $subject, $message, $from); if ($attn == "Expeditions") mail("email here", $subject, $message, $from); if ($attn == "Webmaster") mail("email here", $subject, $message, $from); ?> ok the thing is that it sends a email to Chairperson email but it will not send to the rest shuld i be useing "elseif"? Hi everyone, I have been asked to look into the below E-mail validation script due to a number of people not being able to register their E-mail address on a website of mine. For example, people who's E-mail address begins with a.bcde@fghij.com cannot register and receives an e-mail validation error message. TBH, I pinched the code from somewhere else and do not understand how it works exactly. Could someone help identify which part of the code needs changing? I have highlighted the area of code I believe needs changing, but would appreciate some help. Thanks, function checkemail() { var str = document.getElementById('register-email').value; if ((str.indexOf(".") > 2) && (str.indexOf("@") > 0)) { document.getElementById('emailcheck1').style.backgroundPosition = "top left"; return true; } else { document.getElementById('emailcheck1').style.backgroundPosition = "bottom left"; return false; } } So, I'm trying to make a script that will send emails from apparently anyone. Code: [Select] <?php $email = $_REQUEST['email'] $target = $_REQUEST['target'] $message = $_REQUEST['message'] $subject = $_REQUEST['subject'] mail( $target, $subject, $message, "From: $email" ); echo "Mail sent." ; ?> Here's the HTML, if it matters. Code: [Select] <html> <head> <title>EMAIL SPOOFER</title> </head> <body> <p>This program can make emails appear as if they came from any email address, real or fake!</p> <form method="post" action="mailspoof.php"> Apparent sender: <input name="email" type="text" /><br /> Subject: <input name="subject" type="text" /><br /> Recipient: <input name="target" type="text" /><br /> Message:<br /> <textarea name="message" rows="15" cols="40"> </textarea><br /> <input type="submit" /> </form> </body> </html> Here's the error I'm getting from my webhost: Parse error: syntax error, unexpected T_VARIABLE in /home/a5938041/public_html/mailspoof.php on line 3 If I know me, it's probably the most stupid mistake in the universe, so please point it out. ::) Hi All, I am attaching the code of my php script, the script needs to send mail , but is unable to do so.Your help will be greatly appreciated. Thanks Tanu My first post! Im sorry it has to be a question.. But im also sharing! I found a great php to mail script with attachment. I added it as a text file for if ur intrested in the whole code. Its really easy for adding to your form and has a great way of posting errors. Now my question: The script works great with 1 attachment but how do i add a second attachment? I tried so many things but how hard can it be? Lets say this is a part of your html to upload your files: <html> <body> <form method="post" class="appnitro" action="<?php echo basename($_SERVER["PHP_SELF"]); ?>" enctype="multipart/form-data"> <li id="li_8" > <label class="description" for="element_8">Upload your logo </label> <div> <input name="probe" class="element file" type="file"/> <?php if (isset($_POST['probe'])) echo htmlentities(stripslashes($_POST['probe'])); else echo ""; ?> </div> <p class="guidelines" id="guide_8"><small>Upload your logo here. there is a max of 1 mb</small></p> </li> <li id="li_9" > <label class="description" for="element_9">Upload foto 1 </label> <div> <input name="probe2" class="element file" type="file"/> <?php if (isset($_POST['probe2'])) echo htmlentities(stripslashes($_POST['probe2'])); else echo ""; ?> </div> <p class="guidelines" id="guide_9"><small>Upload your logo here. there is a max of 1 mb</small></p> </li> </form> </body> </html> Heres a part of the php processing // if attachment, MIME-Mail: if (isset($_FILES['probe']['name']) && trim($_FILES['probe']['name']) != "") { // read and encode file: $datei_content = fread(fopen($_FILES['probe']['tmp_name'],"r"),filesize($_FILES['probe']['tmp_name'])); $datei_content = chunk_split(base64_encode($datei_content),76,"\n"); //? encode a second file here? // Boundary: $boundary = md5(uniqid(rand())); // Attachment: $mail_header .= "\n--".$boundary; $mail_header .= "\nContent-Type: ".$_FILES['probe']['type']."; name=\"".$_FILES['probe']['name']."\""; $mail_header .= "\nContent-Transfer-Encoding: base64"; $mail_header .= "\nContent-Disposition: attachment; filename=\"".$_FILES['probe']['name']."\""; $mail_header .= "\n\n".$datei_content; //? attach a second file here? // End: $mail_header .= "\n--".$boundary."--"; Cant i duplicate the encoding and attaching and rename? what am i missing here? Can someone please help me out here? Tnx. Hello Everyone, I've successfully created a form script to check to make sure all my fields are filled out. However, I wanted to create an if statement to check and see if the email address is valid and it contains both and "@", "." symbols. If not then echo '' This is not a Valid email address " if its not correct. Could someone tell me the proper way to write this and incorporate this into my existing script below. Thank you all Again for your Help thanks mrjap1 Code: [Select] // Confirm All feild were filled out when submit button was pressed if($name && $email && $username && $password && $confirm_password) { // Confirm that the NAME that you used is NOT greater than 30 characters if(strlen($name)>24) { echo "<h2><center>YOUR NAME IS TOO LONG!!!!</center></h2><br>"; } // Confirm that the EMAIL that you used is NOT greater than 25 characters if(strlen($email)>25) { echo "<h2><center>YOUR EMAIL IS TOO LONG!!!!</center></h2><br>"; } // Confirm that the USERNAME that you used is NOT greater than 10 characters if(strlen($username)>10) { echo "<h2><center>YOUR USERNAME IS TOO LONG!!!!</center></h2><br>"; } else { // Confirm that the PASSWORD that you used MATCH & Between 6 and 15 characters if(strlen($password)>10 || strlen($password)<6) { echo "<h2><center>YOUR PASSWORD MUST BE BETWEEN 6 and 15 CHARACTERS!!!!</center></h2><br>"; } if($password == $confirm_password) { This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=347725.0 Forbidden You don't have permission to access /cgi-bin/sendmail.php on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Hello! I have the following php code: Code: [Select] <?php // The message $message = "[request("Id_From")]\n [request("ID")]\n [request("CUT")]\n [request("MAKE")]\n [request("CARAT")]\n [request("PRICE_PC")]\n [request("CLARITY")]\n [request("LOCATION")]\n [request("CERTIFICATE")]\n [request("SUP_STOCK_REF")]\n [request("Measurements")]\n [request("Total_Depth")]\n [request("Polish")]\n [request("Table_Width")]\n [request("Symmetry")]\n [request("Crown_Height")]\n [request("Culet")]\n [request("Parillion_Depth")]\n [request("Graining")]\n [request("Girdle")]\n [request("Remarks")]\n [request("TotalPrice")]"; // In case any of our lines are larger than 70 characters, we should use wordwrap() $message = wordwrap($message, 70); // Send mail('gary.impact@gmail.com', 'HIGH PRIORITY DIAMOND ORDER!', $message); ?> where I am trying to send an email to myself which will send me the listed 'requested' values. These values are to the script in the form of: Code: [Select] http://www.somedomain.com/somepage.html?Id_From=123&ID=50250430&CUT=Round&MAKE=VG+-+G++++&CARAT=.5&PRICE_PC=5719&COLOR=D&CLARITY=VVS1&LOCATION=California+%28U.S.A.%29&CERTIFICATE=GIA&SUP_STOCK_REF=3540-6&Measurements=5.03x5.08x3.17&Total_Depth=62.7%25&Polish=V.good&Table_Width=60%25&Symmetry=Good&Crown_Height=&Culet=None&Parillion_Depth=&Graining=&Girdle=&Fluorescence=None&Remarks=&TotalPrice=2860 I am getting the error: Code: [Select] Parse error: syntax error, unexpected T_STRING Which starts on the first line of my requested data ("[request("Id_From")]\n). Any help on this would be truely appreciated! Thank you! $to=sammieave@ave.com,samuel@ave.com; $subject = "New Event Logged"; $message = "Test"; $headers = "From: Samuel<sammieave@ave.com>;\r\n"; $headers .= "Content-Type: text/html"; mail($to,$subject,$message,$headers); I am having the above code but unfortunately the error I am getting is: Warning: mail() [function.mail]: SMTP server response: 550 Requested action not taken: mailbox unavailable or not local in C:\xampp\htdocs\CRM\support\mailer.php on line 139 I'm setting up a newsletter thing for my website. I have a newsletter table in MySQL: Quote +----------------+------+--------+ | email | mens | womens | +----------------+------+--------+ | test2@test.com | 1 | 1 | | test1@test.com | 1 | 0 | +----------------+------+--------+ I am using a HTML form and this PHP code I learn't from the manual, which sends out e-mail's. PHP: if ($_POST['newsletter'] == 'Mens') { $to = ''; $subject = $_POST['subject']; $body = $_POST['body']; $header = 'From: Me Someone <me@someone.com>'; mail($to, $subject, $body, $header); } What I want to do with the above code is send out an e-mail to all the e-mails in my MySQL database that are tagged '1' under mens. How would I go about doing this? I'm guessing I will have to use a MySQL query in the $to = ''; that goes something like this: $to = '$query (select from `newsletters` where `email` = 1'); ? Hello to all out there! this is my first post,so my question may sound a bit simple. :] I am studying PHP and MySQL and I tried to make a mailing form based on a mysql database. My problem occured when I tried to use the PEAR mail object. Here is my code: // THE INCLUDED FILES require_once ("attach_file.php" ); require_once ("Mail.php" ); require_once ("Mail\mime.php" ); //THE VARIABLES TAKEN FROM THE HTML FORM OR JUST CREATED FOR THE CONSTRUCTION OF THE EMAIL $my_email = "something@gmail.com"; $email_subject = mysql_real_escape_string(trim( $_POST['email_subject']),$server_connect ); $email_body = mysql_real_escape_string(trim( $_POST['email_body'] ),$server_connect ); $attached_file = $destination ; // the $destination variable comes from the copy() function in attach_file.php $username = "the_username@gmail.com"; $password = "the_password"; $host = "smtp.gmail.com"; $attach = new Mail_mime(); $attach -> addAttachment($attached_file); $email_body = $attach->get(); $extraheaders = array('from'=>$my_email,'to'=>$email_etaireias,'subject'=>$email_subject,'Bcc'=>$email_etaireias); $headers = $attach -> $headers($extraheaders); // HERE GIVES ME AN ERROR!!! -->Fatal error: Method name must be a string $smtp_info = array('host'=>$host,'auth'=>TRUE,'username'=>$username,'password'=>$password); $smtp = Mail::factory('smtp',$smtp_info); //loop through every single line of the database until there are no more lines with data //and store each line in 3 different variables that i can use while ( $row = mysql_fetch_array($result) ) { $onoma_etaireias = $row['onoma_etaireias']; $email_etaireias = $row['email_etaireias']; $website_etaireias = $row['website_etaireias']; } //construct the mail function . The @ is supressing the errors created .remove it and they will be shown. $mail = @$smtp->send($email_etaireias,$headers,$email_body); As i searched here and there for a solution, i found that it has something to do with the way the mail-mime object creates the body of the email . I also tried to find a solution from the PEAR documentation. do i create the headers someway wrong????? |