Avatar of AHMED SAMY
AHMED SAMY
Flag for Egypt asked on

php 5.2 mail()

is it work?

i take a domain from another company in egypt

my code is :

$to = "**************@yahoo.com";
$subject = "test";
$txt = "check your email ......";
$headers = "From: ******@********.net" . "\r\n" .
"CC: *******@******.net";

mail($to,$subject,$txt,$headers);

echo "sent";

Open in new window


please help
PHP

Avatar of undefined
Last Comment
David Favor

8/22/2022 - Mon
Julian Hansen

What is your question exactly?

Your code seems fine - is it not working? If so then there could be something with your PHP configuration that has not been setup correctly. Mail uses settings in the php.ini file to send email.

A better option might be to use PHPMailer. Among other features it allows you to send mail over an authenticated SMTP link bypassing any localhost configuration issues.

Let us know more about what your problem is - your question as it stands is not clear.
David Favor

I'm with Julian. Your question could be more clear.

I'm guessing what you mean is if you move the above code from one hosting company (machine) to another, will the code work?

If this is your question, then the answer is sometimes yes + many times no.

The only way to ensure mail code works, independent of where it's moved, is to use a relay service.

MailGun is the cheapest. First 10K messages free each month. Be sure to put in a credit card to enable all features, then go through their DNS record setup completely, till you get a 100% verification from their DNS verification tool.
AHMED SAMY

ASKER
i didn't work
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
AHMED SAMY

ASKER
nothing recieved
ASKER CERTIFIED SOLUTION
David Favor

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question