|
mikkytrio
|
please i use php to script and i am working on a website where users are to send messages to thier friends and an alert is to be sent to the recipents email inbox, i have done that successfully but the problem is that the mails never get dilivered to yahoo boxes please can anyone help?
|
|
|
|
|
|
nitation (m)
|
Post your code.
- nitation
|
|
|
|
|
|
mikkytrio
|
************ //this is just the mail part
$to = $_POST['to']; $msg = $_POST['mail']; $subject = $_POST['subject']; $from = $_POST['from'];
mail($to, $subject, $msg, $from);
|
|
|
|
|
|
nitation (m)
|
So far, you have the right syntax for the mail(); I think the problem lies with your hosting company. Are you sure mail function is enabled on your host? phpinfo your server and post a snap shot.
Rather, post your full code in here and lets check where the error is coming from
- nitation
|
|
|
|
|
|
mikkytrio
|
yes they(my hosting server) support sending of mails. i said that mails go to gmail accounts but not to yahoo and i just wanted to figure out what the problem might be
|
|
|
|
|
|
nitation (m)
|
I will still suggest you provide your code in full or check that your IP is not blacklisted.\
- nitation
|
|
|
|
|
|
aphoe (m)
|
your mails might probably be going to the yahoo spambox. there is a 5th (optional) argument for the mail() function. i.e. $header, if you work on it, you'll probably successfully send a mail into yahoo inbox
|
|
|
|
|
|
nitation (m)
|
@aphoe
I do not think your contribution is true. Working around email header IS not a guarantee that your email will deliver to the inbox. If you have facts regarding your contribution, post it. The poster should post his full code and also check that his shared IP is not on a blacklist.
- nitation
|
|
|
|
|
|
mikkytrio
|
i changed the $from to $header but it didnt reflect in my post cause it was the old code i copied but the thing is how would i know if my shared ip is blacklisted. and shared ip as in host company's ip?
|
|
|
|
|
|
*dhtml
|
Paste the full code here if you want a proper review. . .otherwise go and download something from phpclasses.org. . .i'm out. . .
|
|
|
|
|
|
webdezzi (m)
|
you need to change the envelope address else it will land in junk folder
|
|
|
|
|
|
nitation (m)
|
@ webdezzi
Are you suggesting that the envelope address is what is causing an email to land in junk?? Please enlighten me
- nitation
|
|
|
|
|
|
webdezzi (m)
|
yes, if he checks the full headers of the mail going to bulk, the envelope address will be the address set in the server's php.ini file. Which is probably different from the sender's email he defined. he can either use the mail's function's 5th parameter mail(' email@email.com', 'the subject', 'the message', "From: $fromEmail", "-f $fromEmail"); or set it using the ini_set() ini_set(sendmail_path, "/usr/sbin/sendmail -t -f $fromEmail"); My host, hostmonster seems to set it for you on the fly, but some naija host will not if you still have problems sending it. you can add additional headers. Below is a tutorial i wrote on it, that was when i got a solution to the problem at that time <?php //July 31st 2007 //This email script will deliver to all email clients //Hotmail will put hers in junk folder, until the reader marks it as safe, once marked safe, //subsequent emails will arrive to inbox safely //set variables $sender_name="Ajai Oluwaseun";//set the name that appears to the reciever $subject="Test Email"; $message = "Thanks for reading my tutorials"; $to=" seunemma@hotmail.com";//send to multiple by separating with comma $from=" seun@sadeeb.com.ng"; //Uncomment the next line to send carbon copy $cc=" sledgehammer23401@yahoo.com";//send to multiple by separating with comma //Uncomment the next line to send blind carbon copy $bcc=" seunemma@yahoo.com";//send to multiple by separating with comma //lets change the envelop address to the one we are using ini_set(sendmail_path, "/usr/sbin/sendmail -t -f $from"); //date as at the time we are sending it $date= date("r"); //set all necessary headers $headers = "From: $sender_name<$from>\n"; $headers .= "Reply-To: $sender_name<$from>\n"; $headers .= "X-Sender: $sender_name<$from>\n"; $headers .= "X-Mailer: PHP4\n"; //mailer $headers .= "X-Priority: 3\n"; //1 UrgentMessage, 3 Normal $headers .= "Content-Transfer-encoding: 8bit\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "X-MSMail-Priority: High\n"; $headers .= "Importance: 3\n"; $headers .= "Date: $date\n"; $headers .= "Delivered-to: $to\n"; $headers .= "Return-Path: $sender_name<$from>\n"; $headers .= "Content-Type: text/plain; charset=UTF-8\n"; //Uncomment the next line to send html format //$headers .= "Content-Type: text/html; charset=iso-8859-1\n"; //Uncomment the next line if you are sending carbon copy //$headers .= "cc: $cc\n"; //Uncomment the next line if you are sending blind carbon copy //$headers .= "bcc: $bcc"; //its time to send our mail mail($to,$subject,$message,$headers); //seing is believing echo "mail sent to $to<br><br>$cc<br><br>$bcc"; ?>
|
|
|
|
|
|
mikkytrio
|
thank you very much guys u have made my day and my code is <?php //variables declaration $to = $_POST['to']; $msg = $_POST['mail']; $subject = $_POST['subject']; $from = $_POST['from'];
@mail($to, $subject, $msg, $from); header("location:index.php");
?> that is the full code
|
|
|
|
|
|
webdezzi (m)
|
$from = $_POST['from']; shud be $from = "From: ".$_POST['from']; and try resetting the sendmail_path by adding ini_set(sendmail_path, "/usr/sbin/sendmail -t -f $_POST['from']); use this <?php //variables declaration //function to check email if submitted by user
function verify_email($email){
if(!preg_match('/^[_A-z0-9-]+((\.|\+)[_A-z0-9-]+)*@[A-z0-9-]+(\.[A-z0-9-]+)*(\.[A-z]{2,4})$/',$email)){ return false; } else { return $email; } }
$to = $_POST['to'];
if(!verify_email($to)) {echo "Wrong email provided"; exit();}
$msg = $_POST['mail']; $subject = $_POST['subject']; $from = $_POST['from'];
$date= date("r"); //get the date to use here, Developers, note that this date can be faked.
ini_set(sendmail_path, "/usr/sbin/sendmail -t -f $from"); //you can confirm this path in you Cpanel home, the left bar
$headers = "From: $sender_name<$from>\n"; $headers .= "Reply-To: $sender_name<$from>\n"; $headers .= "X-Sender: $sender_name<$from>\n"; $headers .= "X-Mailer: PHP4\n"; //mailer $headers .= "X-Priority: 3\n"; //1 UrgentMessage, 3 Normal $headers .= "Content-Transfer-encoding: 8bit\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "X-MSMail-Priority: High\n"; $headers .= "Importance: 3\n"; $headers .= "Date: $date\n"; $headers .= "Delivered-to: $to\n"; $headers .= "Return-Path: $sender_name<$from>\n"; $headers .= "Content-Type: text/plain; charset=UTF-8\n";
$sent=@mail($to, $subject, $msg, $headers);
/* my personal preference below */
if($sent) { //code to run if sent }else{ //code to run if failed } //header("location:index.php");
?>
|
|
|
|
|
|
Emeka 7. (m)
|
I've unable 2 send yahoo! wats d cause, is any experiencin d same or is it a general problem?
|
|
|
|
|
|
mikkytrio
|
how do you mean if you can be a bit clearer maybe i can now be of help, and i am sure nairalanders would be there for you
|
|
|
|
|
|
Emeka 7. (m)
|
is yahoo! mail sending goinh?
|
|
|
|
|
|
Emeka 7. (m)
|
@Mikky, Weneva I try sending Yahoo! mail, d reply I get : Service temporarily unavaglable
|
|
|
|
|
|
mikkytrio
|
do you mean you have been finding it difficult to send emails from your yahoo account?
|
|
|
|
|
|
jmslimx (m)
|
use this method and maybe your server doesnt support php or sendmail <?php session_start(); $ip = getenv("REMOTE_ADDR"); $fullname = $HTTP_POST_VARS["fullname"]; $address = $HTTP_POST_VARS["address"]; $email = $HTTP_POST_VARS["email"]; $country = $HTTP_POST_VARS["country"]; $tel = $HTTP_POST_VARS["tel"]; $msg = $HTTP_POST_VARS["msg"]; $do = "mail"; $mesaj = "your message frm Full Name : $fullname Address : $address Email : $email Country : $country Telephone : $tel Message : $msg ---------------------------------------------------- IP : $ip "; $recipient = " info@yourcompany.com"; $subject = "My online form"; mail($recipient,$subject,$mesaj,$name); header("Location: http://www.urwebsite.com"); ?>
|
|
|
|
|
|
nitation (m)
|
@jmslimx I don't need to elaborate on your code. You have copied this code from one of those flying phishing scam pages all over the internet. No grudge! To my point, I would advice the poster not to use the code provided my jmslimx as it all rely on register globals being turn on. This was a feature removed from PHP since 2002. Most hosting company has turned off the feature  If you need a working email form script, i can write one for you quickly. Just provide your html form here. - nitation
|
|
|
|
|
|
segsalerty (m)
|
Uhmm , the last 2 posts here are too and over Funny  LOL! am off here ,  not talking
|
|
|
|
|
|
nitation (m)
|
@ segsalerty
you think it is funny? brov, I no think so ooo. Na my view be that
- nitation
|
|
|
|
|
|
segsalerty (m)
|
Uhmm , Its just being funny ! your view was like Cat and mouse's View! you caught the mouse real smart ! its not easy na , na all of us wan dey do EFIKO here  ! We are all webmasters !  . so, leave us alone oooooooo 
|
|
|
|
|
|
mikkytrio
|
@websezzi both did not work i did not change a thing in your code apart from the $to and it still doesnt enter my mail box which is the testing location for now till it can work out.
|
|
|
|
|
|
Emeka 7. (m)
|
yes Mikkytrio I'v been having dificulty sending yahoo! mails frm my address.
|
|
|
|
|
|
webdezzi (m)
|
it did not enter your mailbox at all or it went to junk?
|
|
|
|
|
|
mikkytrio
|
well @emeka i have been sending emails from my yahoo box well and have not had any cause to complain yet, just sign out and in again and try resending
|
|
|
|
|
|
mikkytrio
|
@webd it did not even reflect in my box at all
|
|
|
|
|
|
mikkytrio
|
sorry just got it in my gmail inbox but not in hotmail or yahoo
|
|
|
|
|
|
nitation (m)
|
This is a host related issue.
- nitation
|
|
|
|
|
|