my problem didnt solve please help me!!!

the mail() function

Moderators: macek, egami, gesf

User avatar
raminkit
New php-forum User
New php-forum User
Posts: 48
Joined: Mon Oct 03, 2005 12:54 am

my problem didnt solve please help me!!!

Postby raminkit » Tue Dec 13, 2005 2:18 pm

i write this script and run it on a webserver ,when i went to its address (on the web) i got no error but in mailbox (of raminkit) i didnt got any meessage please help me

Code: Select all

<?php
$mail_to="raminkit@yahoo.com";
$mail_from="shahinkit@yahoo.com";
$mail_reply_to="raminkit@yahoo.com";
$mail_cc="shahinkit@yahoo.com";
$mail_bcc="nooshinkit@yahoo.com";
$mail_headers= "From: $mail_from\r\n\Reply-to: $mail_reply_to\r\n\Cc: $mail_cc\r\nBcc: $mail_bcc";
$mail_subject="php mail test!";
$mail_body="i want to test mail in php .Response me !";
if(mail($mail_to, $mail_subject, $mail_body, $mail_headers))
       echo("ok");
else
echo("no");
?>
Last edited by raminkit on Fri Dec 16, 2005 9:13 am, edited 1 time in total.

User avatar
gesf
Moderator
Moderator
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Postby gesf » Tue Dec 13, 2005 3:38 pm

Your problem: mail(mail_to, $mail_subject, $mail_body, $mail_headers)

User avatar
gesf
Moderator
Moderator
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Postby gesf » Tue Dec 13, 2005 3:39 pm

Use error_reporting(E_ALL); at first in your code so you can be notified about every little error!

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Sun Dec 18, 2005 3:05 am

Yeah, E_ALL is turned on as default on my dev server: i have now found an easy solution to make the code 100% compatible =)

Not that it has ever been hard, but its muuuuch easier that way =)

User avatar
gesf
Moderator
Moderator
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Postby gesf » Sun Dec 18, 2005 3:22 am

You said you have a better solution than its reports !? :? I wanna know that :)

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Sun Dec 18, 2005 3:30 am

ahahaha, i ment i have a better solution how to make all the code E_ALL compatible ;)
Try making a 100% OOP-only code NOT E_ALL compatible and nothing will really work like you want to..
But the thing is that you simply work your way through all the notices you get and.. and it works, after a few days of painfull adaptations: you dont iven get notices anymore: your code is clean and working =)

User avatar
gesf
Moderator
Moderator
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Postby gesf » Sun Dec 18, 2005 3:50 am

Oh i get... that's right! My code is 90% OOP based and yes... now i see i start getting less errors since that! :D

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Sun Dec 18, 2005 3:56 am

gooodie =)
Are you going with MVC?

User avatar
gesf
Moderator
Moderator
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Postby gesf » Sun Dec 18, 2005 6:22 am

hunn... i wouldn't call it MVC. Well.... maybe following a bit its paradigms!

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Sun Dec 18, 2005 7:00 am

Haha, okej!

User avatar
Shiv
php-forum Active User
php-forum Active User
Posts: 262
Joined: Wed Feb 02, 2005 8:06 pm
Location: Ahmedabad (Gujarat), INDIA

Postby Shiv » Sun Dec 18, 2005 9:07 pm

What is MVC? Forgive me if it is dumb question. :)

User avatar
gesf
Moderator
Moderator
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Postby gesf » Sun Dec 18, 2005 9:40 pm

MVC stands for Model, View, Controller.
It is a commonly used and powerful architecture for GUIs.
MVC is best described as what is often known as a design pattern. A design pattern is best defined as a description of a reusable solution to a recurring problem given a particular context.

In this case (OOP), MVC is the solution to best separate the user ontrol of a program (the controller), its output (the view), and its inner processing and decision-making (the model) into a manner whereby they represent three distinct, separable components.

MVC in Web Applications
MVC is considered bu some to be the evolution of IPO (Input, Processing, Output), which was the best-practice model applied to the linear, text-only applications of yesteryear.

The model is represented by your suite of classes, assuming that you have followed an object-oriented approach in your application. In any web language this classes perform the core communication with any external data source, make critical application decisions, and perform parsing and processing on both input and output.

The view is represented by the web browser, or rather what is displyed in it. Upon making a request, be it a simple request for a page or an introdution to update or query a database, the output determined by the model is actually displyed by the web browser.

The controller is also represented by the web browser or rather the users' actions within it. Whether just a series of links or a comples form, the GET and POST requests made by the users' browser represente the effort to get data into the model in the first place.

User avatar
Shiv
php-forum Active User
php-forum Active User
Posts: 262
Joined: Wed Feb 02, 2005 8:06 pm
Location: Ahmedabad (Gujarat), INDIA

Postby Shiv » Sun Dec 18, 2005 10:39 pm

Wow , very nice information. Thanx, gesf. Provide me any link regarding this so that i may refer it further.

ThanX

User avatar
gesf
Moderator
Moderator
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Postby gesf » Sun Dec 18, 2005 10:51 pm


User avatar
Shiv
php-forum Active User
php-forum Active User
Posts: 262
Joined: Wed Feb 02, 2005 8:06 pm
Location: Ahmedabad (Gujarat), INDIA

Postby Shiv » Sun Dec 18, 2005 11:20 pm

ThanX, you people are very helpful.

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Mon Dec 19, 2005 1:51 am

We know ;)

User avatar
raminkit
New php-forum User
New php-forum User
Posts: 48
Joined: Mon Oct 03, 2005 12:54 am

Postby raminkit » Mon Dec 19, 2005 2:07 pm

:o

User avatar
ruturajv
php-forum Super User
php-forum Super User
Posts: 1280
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India
Contact:

Postby ruturajv » Tue Dec 20, 2005 7:50 pm

try this

Code: Select all

<?php
if(mail("yourself@yourdomain.com", "test subject", "test body"))
       echo("ok");
else
  echo("no");
?>


if this does not work check your php.ini file for the SMTP server.


Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 1 guest