Php Mail() To Yahoo Inbox Help Needed

Welcome. Please Login, Register, Or Activate! 
type your username and password to login
Date: November 24, 2009, 12:46 AM
431578 members and 298591 Topics
Latest Member: jadore1
Nairaland [Nigerian Forum] Home Help Search Who is currently online? Login Register
Nairaland Forum  |  Technology  |  Webmasters (Moderators: OmniPotens, yawa-ti-de)  |  Php Mail() To Yahoo Inbox Help Needed
Pages: (1) (2) Go Down Send this topic Notify of replies
Author Topic: Php Mail() To Yahoo Inbox Help Needed  (Read 792 views)
mikkytrio
Php Mail() To Yahoo Inbox Help Needed
« on: March 09, 2009, 10:48 PM »

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)
Re: Php Mail() To Yahoo Inbox Help Needed
« #1 on: March 09, 2009, 10:58 PM »

Post your code.

- nitation
mikkytrio
Re: Php Mail() To Yahoo Inbox Help Needed
« #2 on: March 09, 2009, 11:01 PM »

************
//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)
Re: Php Mail() To Yahoo Inbox Help Needed
« #3 on: March 09, 2009, 11:15 PM »

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
Re: Php Mail() To Yahoo Inbox Help Needed
« #4 on: March 09, 2009, 11:36 PM »

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)
Re: Php Mail() To Yahoo Inbox Help Needed
« #5 on: March 09, 2009, 11:46 PM »

I will still suggest you provide your code in full or check that your IP is not blacklisted.\

- nitation
aphoe (m)
Re: Php Mail() To Yahoo Inbox Help Needed
« #6 on: March 10, 2009, 02:27 AM »

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)
Re: Php Mail() To Yahoo Inbox Help Needed
« #7 on: March 10, 2009, 08:06 AM »

@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
Re: Php Mail() To Yahoo Inbox Help Needed
« #8 on: March 10, 2009, 11:21 AM »

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
Re: Php Mail() To Yahoo Inbox Help Needed
« #9 on: March 10, 2009, 08:09 PM »

Paste the full code here if you want a proper review. . .otherwise go and download something from phpclasses.org. . .i'm out. . .
webdezzi (m)
Re: Php Mail() To Yahoo Inbox Help Needed
« #10 on: March 10, 2009, 08:59 PM »

you need to change the envelope address else it will land in junk folder
nitation (m)
Re: Php Mail() To Yahoo Inbox Help Needed
« #11 on: March 10, 2009, 09:41 PM »

@ webdezzi

Are you suggesting that the envelope address is what is causing an email to land in junk?? Please enlighten me

- nitation
webdezzi (m)
Re: Php Mail() To Yahoo Inbox Help Needed
« #12 on: March 11, 2009, 09:43 AM »

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

Quote

<?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
Re: Php Mail() To Yahoo Inbox Help Needed
« #13 on: March 11, 2009, 11:34 AM »

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)
Re: Php Mail() To Yahoo Inbox Help Needed
« #14 on: March 11, 2009, 03:42 PM »

$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
Quote
<?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)
Re: Php Mail() To Yahoo Inbox Help Needed
« #15 on: March 11, 2009, 06:02 PM »

I've  unable 2 send yahoo! wats d cause, is any experiencin d same or is it a general problem?
mikkytrio
Re: Php Mail() To Yahoo Inbox Help Needed
« #16 on: March 12, 2009, 02:06 AM »

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)
Re: Php Mail() To Yahoo Inbox Help Needed
« #17 on: March 12, 2009, 03:13 AM »

is yahoo! mail sending goinh?
Emeka 7. (m)
Re: Php Mail() To Yahoo Inbox Help Needed
« #18 on: March 12, 2009, 11:26 AM »

@Mikky, Weneva I try sending Yahoo! mail, d reply I get : Service temporarily unavaglable
mikkytrio
Re: Php Mail() To Yahoo Inbox Help Needed
« #19 on: March 12, 2009, 09:32 PM »

do you mean you have been finding it difficult to send emails from your yahoo account?
jmslimx (m)
Re: Php Mail() To Yahoo Inbox Help Needed
« #20 on: March 13, 2009, 07:12 AM »

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)
Re: Php Mail() To Yahoo Inbox Help Needed
« #21 on: March 13, 2009, 08:07 AM »

@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  Shocked

If you need a working email form script, i can write one for you quickly. Just provide your html form here.

- nitation
segsalerty (m)
Re: Php Mail() To Yahoo Inbox Help Needed
« #22 on: March 13, 2009, 04:10 PM »

Uhmm , the last 2 posts here are too and over Funny Grin Grin Grin LOL!
am off here ,   Lips sealed Lips sealed Lips sealed not talking
nitation (m)
Re: Php Mail() To Yahoo Inbox Help Needed
« #23 on: March 13, 2009, 04:13 PM »

@ segsalerty

you think it is funny? brov, I no think so ooo. Na my view be that

- nitation
segsalerty (m)
Re: Php Mail() To Yahoo Inbox Help Needed
« #24 on: March 13, 2009, 11:03 PM »

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  Cheesy! We are all webmasters !  Tongue Tongue Tongue.
so, leave us alone oooooooo Grin
mikkytrio
Re: Php Mail() To Yahoo Inbox Help Needed
« #25 on: March 14, 2009, 02:27 AM »

@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)
Re: Php Mail() To Yahoo Inbox Help Needed
« #26 on: March 14, 2009, 08:53 AM »

yes Mikkytrio I'v been having dificulty sending yahoo! mails frm my address.
webdezzi (m)
Re: Php Mail() To Yahoo Inbox Help Needed
« #27 on: March 14, 2009, 03:50 PM »

it did not enter your mailbox at all or it went to junk?
mikkytrio
Re: Php Mail() To Yahoo Inbox Help Needed
« #28 on: March 14, 2009, 03:58 PM »

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
Re: Php Mail() To Yahoo Inbox Help Needed
« #29 on: March 15, 2009, 02:17 AM »

@webd
it did not even reflect in my box at all
mikkytrio
Re: Php Mail() To Yahoo Inbox Help Needed
« #30 on: March 15, 2009, 02:20 AM »

sorry just got it in my gmail inbox but not in hotmail or yahoo
nitation (m)
Re: Php Mail() To Yahoo Inbox Help Needed
« #31 on: March 15, 2009, 09:03 AM »

This is a host related issue.

- nitation
 How to Cash [Affiliate Program] Cheques in Nigeria  Learn Html/ Website Design (for Beginner & Pro) Free  Web Development Partnership  Page 2
Pages: (1) (2) Go Up Send Topic to Friend by E-mail Reply 


Sections: Autos/Cars (2) Jobs/Vacancies (2) (3) Career Talk Education General(2) Politics Romance Computers Phones Travel
Sports Fashion Health Religion Celebrities TV/Movies (2) Music/Radio (2) Books Webmasters Programming

Links: Page1 Page2 Page3 Page4 Page5 Page6 Page7 Page8 Page9 Page10

Nairaland is owned by Oluwaseun Osewa. See also: Nairalist Classified Ads
Nairaland Forum | Powered by SMF 1.0.12.
© 2001-2005, Lewis Media. All Rights Reserved.