473,395 Members | 1,730 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

sending email from a php page

Hi, Everyone
I m working on a complaint management site and one of the requirement is sending a email to the administrator.

I changed the php.ini file now it looks like
Expand|Select|Wrap|Line Numbers
  1. [mail function]
  2. SMTP = my outgoing smtp mail server
  3. sendmail_from = myid1@gmail.com
  4. ; For Unix only.  You may supply arguments as well (default: 'sendmail -t -i').
  5. sendmail_path = /usr/local/sbin/sendmail
  6.  
My code is quite simple
Expand|Select|Wrap|Line Numbers
  1. <?php 
  2. if(mail('myid2@gmail.com', 'Hi', 'Hello'))
  3. {
  4.  echo('<p>Mail sent successfully 3.</p>'); 
  5. }
  6. else
  7. {
  8.  echo('<p>Mail could not be sent.</p>');
  9. }
  10. ?>
Now i m getting mail sent successfully as the output
Everything sounds so good till here,but the problem here is that the mail is not getting delivered to myid2@gmail.com(both the email's are valid)
My php version doesnt support getmxrr() so i m not able to check has the mail been delivered to the recipient mail server or not.


I m using
OS: Windows XP Professional Service Pack 2, v.2096 (build 2600)
Php: 4.1.1
Server API: CGI

If any more information is required then please let me know.
Hoping for some quick help!!!
Anyone Please,Thanks In advance.
Aug 1 '07 #1
4 1522
djpaul
137 100+
Did you use the right parameters in the head?
See headers...
Like so:
[PHP]
$to = "the@emailadres.com";
$subject = "Put your subject down here.";
$message = "Here you can put your message";

$headers = 'From: the.other@email.com' . "\r\n" .
'Reply-To: noreply@email.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();

mail ($to, $onderwerp, $message, $headers);
echo "<p align=\"center\">Email succesfully send...";
[/PHP]

Gr Paul
Aug 1 '07 #2
Did you use the right parameters in the head?
See headers...
Like so:
[PHP]
$to = "the@emailadres.com";
$subject = "Put your subject down here.";
$message = "Here you can put your message";

$headers = 'From: the.other@email.com' . "\r\n" .
'Reply-To: noreply@email.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();

mail ($to, $onderwerp, $message, $headers);
echo "<p align=\"center\">Email succesfully send...";
[/PHP]

Gr Paul
As header's are the optional field in mail function so i didnt use them
Anyways i used them to but still no error and no mail delivery either.

What was that $onderwerp that u used instead of $subject.
and i m not having x mailer installed.
i m using php triad as i mentioned

Nothing is working!!!
Thanx in advance.
Aug 3 '07 #3
kovik
1,044 Expert 1GB
You could send messages with an SMTP connection using Swiftmailer.
Aug 4 '07 #4
djpaul
137 100+
Oh sorry,
That was the $subject but that's in dutch.
I replaced the $onderwerp to $subject but i forgot to change it in the mail function.
Gr Paul
Aug 6 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Joe | last post by:
Hi, I am sending an email from an asp page. Besides sending an email to sender, I am sending myself a BCC also. Out of 100 emails sent, about 5 recipients received a blank email (no text in...
3
by: VB Programmer | last post by:
I have an ASPX page where I send out emails through my mail server mail.MyDomain.com. When I send emails to MyName@MyDomain.com it sends PERFECTLY. When I try sending an email to any other address...
6
by: Eduardo Rosa | last post by:
Somebody knows how I queue email using .Net? thanks a lot
1
by: Eric Sheu | last post by:
Greetings, I have been searching the web like mad for a solution to my SMTP problem. I am using Windows Server 2003 and ASP.NET 2.0 w/ C# to send out e-mails from a web site I have created to...
21
by: Emeka | last post by:
Hello, Please how can I set up an email box in my domain. I have the php code and wish to create an email address as a recipient. The attached is the php codes I intend to use. Thanks Emeka
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.