Jump to content

unable to send text to MetroPCS using PHP Mail


phppup

Recommended Posts

I have an old script for sending a text message to cellphone via PHP mail.

The script has not changed in a year, and it did work approximately 9 months ago.

Now, after dusting off the script and trying it, no message is received on the cellphone.

When sent directly from my email account to 1231231234@mymetropcs.com, a text message arrives nearly immediately.

But when sent through my email server script, even as a simplified test script

<?php
 
 mail( '1231231234@mymetropcs.com', "How are you", "Your packaged has arrived!", "From: Me <MyEmail@yahoo.com>\r\n");

//OR even  mail( '1231231234@mymetropcs.com', "", "Your packaged has arrived!", "From: Me <MyEmail@yahoo.com>\r\n");
 
?>

there is still nothing received on cellphone.

How can I resolve this?

Are there anti-spam filters generally in place and how can I overcome them?

Is there a way to validate that the message I am sending is actually leaving the server?

Or are there settings [there were none before and normal email messages are sent without any problems] that need to be adjusted to send a text message?

Thanks for the help.

Link to comment
Share on other sites

Don't claim to be someone you are not. If you want to attach your @yahoo.com email then you need to be sending this through your Yahoo mail account. As in configuring PHP and/or your server to send through it.

Change the from to be something according to your domain name, see if that works.

Link to comment
Share on other sites

Sent identical messages: one to email, another to cellphone.  Only received the email.  So I guess this proves (barring any code to provide support) that the email function is sending outbound messages.

 mail( '1231231234@mymetropcs.com', "How are you", "Your packaged has arrived!", "From: Me <MyOtherEmail@yahoo.com>\r\n");
   
    mail( 'myemail@yahoo.com', "How are you", "Your packaged has arrived!", "From: Me <MyOtherEmail@yahoo.com>\r\n");

Are there any new issues with MetroPCS since they merged with T-Mobile in the USA?

(MetroPCS personnel are essentially worthless in this matter.)

Link to comment
Share on other sites

According to your code you're still claiming to be sending from @yahoo.com. When I said not to do that, it wasn't a casual idea. Really. Don't do that.

You could be getting caught in spam filters. Try using PHPMailer or Swift Mailer to send it.

Link to comment
Share on other sites

Sorry, but I did immediately make the change that you suggested.  I just didn't convert it properly when cutting and pasting from the previous post.

In fact, I agree with your appraisal and had experienced getting caught by those filters before.

At this point I have used both my Yahoo addresses and my me@mydomainname.com and gotten similar results.

The regular email (when not intercepted by spam filter) arrived in my inbox, but not a single text message has arrived on my phone via MetroPCS (except for an initial test sent directly from my Yahoo account, but not through PHP mail).

 

 

Link to comment
Share on other sites

He's talking about using this or this, and checking the documentation about how to do so. Yes, you should be able to set up SMTP via Gmail on both. I've not used Yahoo or Swift, to be honest, but I use PHPMailer on a regular basis and can tell you it's simple and it works much better than PHP's native mail() function.

Link to comment
Share on other sites

If I get it working again I'll let you know.

I found this sample code that is SUPPOSED to work, but something is causing it to provide:  Mailer Error: SMTP connect() failed.

<?php
$status = "";
$subject = "Sending Email Using PHP Mailer";
$body ='<p>Congratulations!</p>';
$body .='<p>You have successfully received an email from.</p>';
// Enter Your Email Address Here To Receive Email
$email_to = "my_yahoo_email@yahoo.com";

$email_from = "myTESTemail@my_domain.com"; // Enter Sender Email
$sender_name = "Mister Mail"; // Enter Sender Name
require("PHPMailer/PHPMailerAutoload.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "mail.my_domain.com"; // Enter Your Host/Server
$mail->SMTPAuth = true;
$mail->Username = "myTESTemail@my_domain.com"; // Enter Sender Email
$mail->Password = "theTESTpassword";
//If SMTP requires TLS encryption then remove comment from it
//$mail->SMTPSecure = "tls";
$mail->Port = 25;       //tried 25 and 587
$mail->IsHTML(true);
$mail->From = $email_from;
$mail->FromName = $sender_name;
$mail->Sender = $email_from; // indicates ReturnPath header
$mail->AddReplyTo($email_from, "No Reply"); // indicates ReplyTo headers
$mail->Subject = $subject;
$mail->Body = $body;
$mail->AddAddress($email_to);
// If you know receiver name using following
//$mail->AddAddress($email_to, "Recepient Name");
// To send CC remove comment from below
//$mail->AddCC('username@email.com', "Recepient Name");
// To send attachment remove comment from below
//$mail->AddAttachment('files/readme.txt');
/*
Please note file must be available on your
host to be attached with this email.
*/

if (!$mail->Send()){
	$status = "Mailer Error: " . $mail->ErrorInfo;
	}else{
	$status = "<div style='color:#FF0000; font-size:20px; font-weight:bold;'>
	An email has been sent to your email address.</div>";
}
?>

<html>
<head>
<title>Send Email in PHP Using PHPMailer - AllPHPTricks.com</title>
</head>
<body>
<?php echo $status; ?>
<br /><br />
</body>
</html>

Not exactly sure if it's a C-Panel email issue, or the code, or just my lack of expertise.  Any suggestions for finding a solution.

Link to comment
Share on other sites

I thought it would get easier, but I was wrong.  LOL

Took maxxd advice and added to the top of my script,

<?php
$status = "";

$mail->SMTPDebug = 2;

$subject = "Sending Email Using PHP Mailer";

but I didn't see any change in the Error Message which simply states:    Mailer Error: SMTP connect() failed

 

In other news, I did get a 'supposedly correct' relay-server for outgoing SMTP mail and confirmed that emails sent from my domain name are going out through that server.  I was also told that NO AUTHENTICATION is required.  So now the question is whether to eliminate Username and Password OR use empty quotes (as they suggested).

Still struggling here. 

PS to  requinix:  YES, while testing the outbound server to confirm that my mail was sending, I tested to my cell and it did display the sender's info.
 

 

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.