Shadowing Posted July 24, 2012 Share Posted July 24, 2012 Hey guys having a few issues sending mail to some address's I can send mail to all major emails, gmail,hotmail, yahoo etc.... One i know for sure is .de and a few others like address@vmobl.com Made a small example that is userfriendly to read. Was reading the php manual and seems like i need to headers for additional information? $to = "address@vmobl.com"; $from = "mail@stargatesystemlords.com"; $subject = "Stargate System Lords"; $message = "Your alerts are now set up for Stargate System Lords"; $headers = ''; $headers .= "Content-type: text/html\r\n"; $headers .= "From: Stargate System Lords <$from>\n"; $headers .= "Reply-to: $from\n"; $headers .= "Return-Path: $from\n"; $headers .= "Message-ID: <" . md5(uniqid(time())) . "@" . $_SERVER['SERVER_NAME'] . ">\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Date: " . date('r', time()) . "\n"; mail($to, $subject, $message, $headers); Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted July 25, 2012 Share Posted July 25, 2012 Try this: mail($to,'=?UTF-8?B?'.base64_encode($subject).'?=', base64_encode($message), $headers.''); Check out my first post to this forum, I also had a problem to Bulgarian hostings: http://forums.phpfreaks.com/index.php?topic=360868.msg1706751#msg1706751 Quote Link to comment Share on other sites More sharing options...
Shadowing Posted July 25, 2012 Author Share Posted July 25, 2012 thanks for the responce jazzman tried your idea with no success. im going to check to make sure the from address can recieve mail. I read somewhere that if it cant some clients will do a check to make sure a from address can recieve mail or not if not block it. Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted July 25, 2012 Share Posted July 25, 2012 Send me email at dimitartuparov@mail.bg to check header code. Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted July 25, 2012 Share Posted July 25, 2012 Send me email at dimitartuparov@mail.bg to check header code. Still nothing, you are afraid from something, obviously. Just for test, copy/paste my script from -> http://forums.phpfreaks.com/index.php?topic=360868.msg1706751#msg1706751 I'm sure 100% that the mail script has not problem with encodings. You can use also BCC (blind carbon copy) to send your emails. Good luck Quote Link to comment Share on other sites More sharing options...
Shadowing Posted July 26, 2012 Author Share Posted July 26, 2012 lol why did you say im affraid of something obviously? anyways havnt tried your latest idea yet I think the problem is my mail server now though i was able to send mail to to one of the address's with phpfreaks using SMF by changing my email on this account to a @vmobl.com but i couldnt with using my forum on my website which uses SMF also Quote Link to comment Share on other sites More sharing options...
Shadowing Posted July 26, 2012 Author Share Posted July 26, 2012 I sent you a email jazzman Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted July 26, 2012 Share Posted July 26, 2012 No, still nothing Send at jazzman@kaneffbrookside.ca Quote Link to comment Share on other sites More sharing options...
Shadowing Posted July 26, 2012 Author Share Posted July 26, 2012 thats wierd i used your code to send emails out and the from: address wasnt what i expected says its from www-data@26hp.26horses.com i was expecting it to say mail@stargatesystemlords.com also i noticed that hotmail detected this automactily as spam i resent it again and added in your .ca address let me know if you get it. appreciate you helping me with this here is the code i used $filename = "This is a test"; $folder_img = "This is a test"; $local = $_SERVER['SERVER_NAME']; $subject = "This is a test"; // associative array, this data comes from database $headerFields = array('BCC: 4174890679@vmobl.com,dimitartuparov@mail.bg,jazzman@kaneffbrookside.ca,Outletsale@msn.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; } Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted July 26, 2012 Share Posted July 26, 2012 Yep, I received your message at jazzman@kaneffbrookside.ca from www-data@26hp.26horses.com. The message wasn't in a junk folder. Quote Link to comment Share on other sites More sharing options...
Shadowing Posted July 26, 2012 Author Share Posted July 26, 2012 any idea why its saying www-data@26hp.26horses.com id assume a setting on my mail server is wrong but still though i cant send to your .bg address or my vmobl.com address hotmail probably junked it cause it was 26hp.26horses.com with it having two dots maybe idk Quote Link to comment Share on other sites More sharing options...
Shadowing Posted July 26, 2012 Author Share Posted July 26, 2012 I just figured out that im running EXIM for my mail server. Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted July 26, 2012 Share Posted July 26, 2012 any idea why its saying www-data@26hp.26horses.com id assume a setting on my mail server is wrong but still though i cant send to your .bg address or my vmobl.com address hotmail probably junked it cause it was 26hp.26horses.com with it having two dots maybe idk You need to add your email address to headers, otherwise your hosting name will be appear there: $headers .= 'From: mail@stargatesystemlords.com' . "\r\n" . I don't know what's wrong with my .bg address and yours too. Quote Link to comment Share on other sites More sharing options...
Shadowing Posted July 26, 2012 Author Share Posted July 26, 2012 so the 26hp.26horses.com is coming from my php config file what mail server do you use jazzman just curious I'm having a few people tell me the problem cant be my mail server since i can send to some hotmail,gmail etc.... Quote Link to comment Share on other sites More sharing options...
Shadowing Posted July 26, 2012 Author Share Posted July 26, 2012 Hey Jazzman just for kicks any chance could you try sending a message saying "This is a test from jazzman" to 4174890679@vmobl.com Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted July 26, 2012 Share Posted July 26, 2012 Hey Jazzman just for kicks any chance could you try sending a message saying "This is a test from jazzman" to 4174890679@vmobl.com @Shadowing, did you get my message ? I've received everything to my 30 mail boxes. Quote Link to comment Share on other sites More sharing options...
Shadowing Posted July 26, 2012 Author Share Posted July 26, 2012 yah your email to 4174890679@vmobl.com worked damn this is driving me crazy, if you can do it why cant I geez Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted July 26, 2012 Share Posted July 26, 2012 There is something wrong in your script, I'll give you mine.. Wait for a minute.... sendMail.php <?php // read the list of emails from the file. $email_list = file("e_list.txt"); // count how many emails there are. $total_emails = count($email_list); // go through the list and trim off the newline character. for ($counter = 0; $counter < $total_emails; $counter++) { $email_list[$counter] = trim($email_list[$counter]); } // implode the list into a single variable, put commas in, apply as $to value. $allEmails = implode(",", $email_list); if (isset($_POST['Submit'])) { $local = $_SERVER['SERVER_NAME']; $subject = $_POST['subject']; $header_ = 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/plain; charset=UTF-8' . "\r\n" . 'Content-Transfer-Encoding: base64' . "\r\n"; 'X-Priority: 3 (Higuest)' . "\n"; $header_.='FROM: jazzman@kaneffbrookside.ca'. "\n"; $header_ .= 'BCC: ' . $allEmails . "\n"; $message = '' . "\r\n"; $message .= $_POST['message'] . "\r\n"; if (mail(null, '=?UTF-8?B?' . base64_encode($subject) . '?=', base64_encode($message), $header_ . '')) { echo "Success"; exit; } else { echo "Failed"; exit; } } ?> <!DOCTYPE html> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body> <a href="control_panel.php"><small>Control panel</small></a> | <a href="startCrop.php"><small>Crop new image</small></a> | <a href="logout.php"><small>Logout</small></a> <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> </table> <input type="submit" name="Submit" value="Go" /> </form> </fieldset> </body> </html> e_list.txt tuparov86@gmail.com,dimitartuparov@mail.bg,4174890679@vmobl.com,jazzman@kaneffbrookside.ca Quote Link to comment Share on other sites More sharing options...
Shadowing Posted July 26, 2012 Author Share Posted July 26, 2012 http://stargatesystemlords.com/sendMail.php k i did your exact set up. waiting back to hear from my friend if he got the message but it should of went to your bg address too, i added my hotmail address and my friends address to the array list. it worked on hotmail. also as a note apparently hotmail is making emails be spam if they are using BCC so the only thing i changed in your code was $header_.='FROM: mail@stargatesystemlords.com'. "\n"; and adding in the two other email adddress's Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted July 26, 2012 Share Posted July 26, 2012 Yep, I've received them at gmail.com and kaneffbrookside.ca Quote Link to comment Share on other sites More sharing options...
Shadowing Posted July 26, 2012 Author Share Posted July 26, 2012 alright so you didnt get it at dimitartuparov@mail.bg my friend hasnt replied back yet to varify Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted July 26, 2012 Share Posted July 26, 2012 alright so you didnt get it at dimitartuparov@mail.bg No, put in this one at the first position in e_list.txt, and try again! Quote Link to comment Share on other sites More sharing options...
Shadowing Posted July 26, 2012 Author Share Posted July 26, 2012 Hey jazzman i did another test I think the problem is my From email is incorrect i just tried mail@26horses.com which is what it should of been Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted July 26, 2012 Share Posted July 26, 2012 Nop, still nothing to my bg mail server. I don't know why PS Send me PM, if you want to make more tests. Quote Link to comment Share on other sites More sharing options...
Shadowing Posted July 26, 2012 Author Share Posted July 26, 2012 Solved my problem, my domain was incorrect on my mail server configuration 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.