Connecting Tech Pros Worldwide Forums | Help | Site Map

PHP mail() function problem

noha khalifa
Guest
 
Posts: n/a
#1: Nov 12 '08
Hi all,

I want to send mails using php mail() function, my web server is
apache on linux i just add this line to my code
ini_set('sendmail_from', 'users@must.edu.eg');

i'm sending emails to users at the same domain ....@must.edu.eg but it
didn't send mail also it don't give any errors

but i'm sure that mail server is working coz when i'm trying to send
mails to the same domain through outlook it works well.

i tried to send to hotmail it sends just one mail but when i tried
again the same happened no mails sent with no error.

where do u think the problem????

Jerry Stuckle
Guest
 
Posts: n/a
#2: Nov 12 '08

re: PHP mail() function problem


noha khalifa wrote:
Quote:
Hi all,
>
I want to send mails using php mail() function, my web server is
apache on linux i just add this line to my code
ini_set('sendmail_from', 'users@must.edu.eg');
>
i'm sending emails to users at the same domain ....@must.edu.eg but it
didn't send mail also it don't give any errors
>
but i'm sure that mail server is working coz when i'm trying to send
mails to the same domain through outlook it works well.
>
i tried to send to hotmail it sends just one mail but when i tried
again the same happened no mails sent with no error.
>
where do u think the problem????
You didn't show your code, so it's impossible to tell.

You shouldn't be using ini_set for 'sendmail_from' - that's just a
default value. Rather, you should be using the From: header in your
mail() command to set who it is from.

If you were able to get one email sent to hotmail, then you are able to
connect to an MTA. But is this MTA set up to limit the number of emails
sent in a certain period of time?

Additionally, how do you know the email didn't get sent? If you're
checking to see if it has been received, that's not accurate. It could
have been dumped by the receiving email system as spam, for instance.

The code you're using would be a big help in helping with your problem.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
noha khalifa
Guest
 
Posts: n/a
#3: Nov 12 '08

re: PHP mail() function problem


This is my code

$EMail="nkhalifa@must.edu.eg";

$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=windows-1256' . "\r\n";

// Additional headers

$headers .= "Bcc: nkhalifa@must.edu.eg\r\n" ;


ini_set('sendmail_from', 'users@must.edu.eg');
// Mail it
mail($EMail, $subject, $message, $headers);
Jessica Griego
Guest
 
Posts: n/a
#4: Nov 12 '08

re: PHP mail() function problem



"Michael Vilain" <vilain@NOspamcop.netwrote in message
news:vilain-A08DF5.10210412112008@feeder.motzarella.org...
Quote:
In article
<1f0bdefb-4d89-4e6c-b9f8-506935235b4b@a17g2000prm.googlegroups.com>,
<snip>
Quote:
[I filter all Goggle Groups posts, so any reply may be automatically by
ignored]
Why is that, Michael?


Jerry Stuckle
Guest
 
Posts: n/a
#5: Nov 12 '08

re: PHP mail() function problem


noha khalifa wrote:
Quote:
This is my code
>
$EMail="nkhalifa@must.edu.eg";
>
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=windows-1256' . "\r\n";
>
// Additional headers
>
$headers .= "Bcc: nkhalifa@must.edu.eg\r\n" ;
>
>
ini_set('sendmail_from', 'users@must.edu.eg');
// Mail it
mail($EMail, $subject, $message, $headers);
Rather than use ini_set, you should be adding to your header:

"From: users@must.edu.eg\r\n"

It often helps to also have

"ReplyTo: users@must.edu.eg\r\n"

Additionally, the last header should NOT have "\r\n" after it.

You don't show what's in $subject, but that, also, should not have
"\r\n" after it. It may be OK.

You're also sending only html email. What about those who can't display
html? Additionally, some spam filters will filter out html-only email
(or at least increase the score, which might get you filtered).

If you're going to send html email, you really should use PHPMailer. It
does a lot of this for you, and makes your life much easier.
Additionally, it will allow you to send the email as both text and html,
so those who can't receive html can still see it, and spam filters are
less likely to boot it out.

Hope this helps.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Jessica Griego
Guest
 
Posts: n/a
#6: Nov 12 '08

re: PHP mail() function problem



"Michael Vilain" <vilain@NOspamcop.netwrote in message
news:vilain-A78DD8.12141912112008@feeder.motzarella.org...
Quote:
In article <7%FSk.4285$pr6.2319@flpi149.ffdc.sbc.com>,
"Jessica Griego" <jess@example.comwrote:
>
Quote:
>"Michael Vilain" <vilain@NOspamcop.netwrote in message
>news:vilain-A08DF5.10210412112008@feeder.motzarella.org...
Quote:
In article
<1f0bdefb-4d89-4e6c-b9f8-506935235b4b@a17g2000prm.googlegroups.com>,
>>
><snip>
>>
Quote:
[I filter all Goggle Groups posts, so any reply may be automatically by
ignored]
>>
>Why is that, Michael?
>
s/n ratio < 1
LOL.

Well if they can't figure out how to use a newreader, they probably do need
a bit of coddling when they try to program. :)


noha khalifa
Guest
 
Posts: n/a
#7: Nov 13 '08

re: PHP mail() function problem


I used also phpmailer and again no emails sent :(
noha khalifa
Guest
 
Posts: n/a
#8: Nov 13 '08

re: PHP mail() function problem


I tried to change 'Content-Type: text/HTML' into 'Content-Type: text/
plain' and it now sends to hotmail well.

but it don't send to the other mails in the domain must.edu.eg
noha khalifa
Guest
 
Posts: n/a
#9: Nov 13 '08

re: PHP mail() function problem


Sorry , but i don't know from where i can get sendmail log, my
webserver is on linux o/s and path of senmail is /usr/sbin/sendmail

Where i can find log file

Jerry Stuckle
Guest
 
Posts: n/a
#10: Nov 13 '08

re: PHP mail() function problem


noha khalifa wrote:
Quote:
Sorry , but i don't know from where i can get sendmail log, my
webserver is on linux o/s and path of senmail is /usr/sbin/sendmail
>
Where i can find log file
>
It will be under your /var/log directory - perhaps a subdirectory in
there. Exactly where depends on your setup.

And how do you know you can't send to them? It's entirely possible you
can send to them but it's being booted out by their server (as with your
problem with gmail).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Jerry Stuckle
Guest
 
Posts: n/a
#11: Nov 13 '08

re: PHP mail() function problem


noha khalifa wrote:
Quote:
I used also phpmailer and again no emails sent :(
No mails are sent - or no mails are received? There is a huge difference.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
noha khalifa
Guest
 
Posts: n/a
#12: Nov 18 '08

re: PHP mail() function problem


I checked the Log file and i found the following lines :

Nov 17 14:13:30 MUST-WebServer sendmail[2294]: mAHCDUn9002294:
to=28495@must.edu.eg, ctladdr=users@must.edu.eg (48/48),
delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=31760, relay=
[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (mAHCDUbS002295 Message
accepted for delivery)

Nov 17 14:13:30 MUST-WebServer sendmail[2297]: mAHCDUbS002295:
to=<28495@must.edu.eg>, delay=00:00:00, xdelay=00:00:00, mailer=esmtp,
pri=122094, relay=must.edu.eg, dsn=5.1.2, stat=Host unknown (Name
server: must.edu.eg: host not found)
Charles Calvert
Guest
 
Posts: n/a
#13: Nov 18 '08

re: PHP mail() function problem


On Mon, 17 Nov 2008 23:34:49 -0800 (PST), noha khalifa
<ChickenLittle78@gmail.comwrote in
<3a937f52-0a28-4745-895d-d239287b386c@h23g2000prf.googlegroups.com>:
Quote:
>I checked the Log file and i found the following lines :
>
>Nov 17 14:13:30 MUST-WebServer sendmail[2294]: mAHCDUn9002294:
>to=28495@must.edu.eg, ctladdr=users@must.edu.eg (48/48),
>delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=31760, relay=
>[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (mAHCDUbS002295 Message
>accepted for delivery)
>
>Nov 17 14:13:30 MUST-WebServer sendmail[2297]: mAHCDUbS002295:
>to=<28495@must.edu.eg>, delay=00:00:00, xdelay=00:00:00, mailer=esmtp,
>pri=122094, relay=must.edu.eg, dsn=5.1.2, stat=Host unknown (Name
>server: must.edu.eg: host not found)
This second line is the one that is important. Note that it says that
it couldn't find the server must.edu.eg. When I run an nslookup on
it, I get:

Non-authoritative answer:
Name: must.edu.eg
Address: 192.168.5.3

It looks like the DNS record for this server is configured to point to
a nonroutable address. See
<http://en.wikipedia.org/wiki/IP_address#IPv4_private_addressesfor
more info.

Is your server on the same network and subnet with must.edu.eg? If
not, you won't be able to connect to it via that domain name.
--
Charles Calvert | Web-site Design/Development
Celtic Wolf, Inc. | Software Design/Development
http://www.celticwolf.com/ | Data Conversion
(703) 580-0210 | Project Management
Closed Thread