jazzman1 Posted June 13, 2012 Share Posted June 13, 2012 Hi guys, few months ago I've started a new project - http://stdimitar.org. The site was deployed and is being hosted by godaddy Economy hosting plan. I've created a php script using a php based mail function to send a mass of e-mails to our subscribers, around 1000 mails a day. My problem is that I don't know how many emails are actually sent to their email accounts. If anybody knows a better way to solve the problem, please tell me. I want to share my script and so sorry for my English. jazzman <?php if (isset($_POST['Submit'])) { $local = $_SERVER['SERVER_NAME']; $subject = $_POST['subject']; // associative array, this data comes from database $headerFields = array('BCC: example_1@example.com,example_2@example.com,example_3@example.com,example_4@example.com,example_5@example.com'); $headers = 'MIME-Version: 1.0' . "\n" . 'Content-type: text/plain; charset=UTF-8' . "\n" . 'Content-Transfer-Encoding: base64' . "\n"; 'X-Priority: 1 (Higuest)' . "\n"; 'X-MSMail-Priority: High' . "\n"; 'Importance: High' . "\n"; $headers .= implode(',', $headerFields)."\n"; $message = ''."\n"; $message .= $_POST['message'] . "\n"; // link to image or church bulletin $message .= 'http://' . $local . '/'. $folder_img.'/'. $filename ."\n"; if(mail(null, '=?UTF-8?B?'.base64_encode($subject).'?=', base64_encode($message), $headers . '')){ echo "Mail has been successfully sent"; exit; } } ?> <!DOCTYPE html> <html> <head> <title>Send a message to subscribers</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body> <fieldset> <legend><h2>Crop new image and send a message to subscribers</h2></legend> <form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post" enctype="multipart/form-data" accept-charset="utf-8"> <table border="0" width="100%" cellpadding="0" cellspacing="0"> <tr align="left" valign="top"> <th>Title:</th> <td><input type="text" name="subject" value="" /></td> </tr> <tr><td> </td></tr> <tr align="left" valign="top"> <th width="160">Message:</th> <td><textarea row="30" cols="50" name="message"></textarea></td> </tr> <tr><td> </td></tr> <tr align="left" valign="top"> <th>Send image:</th> <td><input type="file" name="fupload" value=""/></td> </tr> <tr><td> </td></tr> </table> <input type="submit" name="Submit" value="Go" /> </form> </fieldset> </body> </html> Quote Link to comment Share on other sites More sharing options...
scootstah Posted June 13, 2012 Share Posted June 13, 2012 The most you can do is make sure mail() ran without errors. There is no way to reliably tell if the mail was actually delivered. Quote Link to comment Share on other sites More sharing options...
Mike_GoDaddy Posted June 20, 2012 Share Posted June 20, 2012 Using the mail() function and generating that "mail was successfully sent" message will tell you if the message sent successfully. The best way to verify that is it being delivered is to set a "from" addresses in the $header variable so that our system or the remote system knows whom to notify if delivery fails. Just remember to use an email address you setup with Go Daddy for this. Also, Go Daddy shared hosting limits you to 1000 emails per day so anything more than that will not send properly. Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted June 30, 2012 Author Share Posted June 30, 2012 Thank you guys. Quote Link to comment 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.