473,809 Members | 2,625 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

send email automatically

6 New Member
helo......
i want to send email automatically.. but it doesn't work...
and display msg not sent..
this is my code....plz check if there any error.......
i'm a new in php... plz help me...

Expand|Select|Wrap|Line Numbers
  1. $recipent = "smile@example.com";
  2. $subject = "attention";
  3.  
  4. $fname = "farah";
  5. $email = "wfarah@example.com";
  6. $msg = "fail";
  7.  
  8. $body = "Sender: " . $fname . "\n\nEmail: " . $email . "\n\nMessage:\n\n" . $msg;
  9. if (@mail($recipent, $subject, $body)) { echo "msg sent"; }
  10. else { echo "msg not sent"; }
Apr 1 '10 #1
3 5048
Atli
5,058 Recognized Expert Expert
Hey.

There is nothing essentially wrong with the code. No syntax errors or such. If the mail() function is configured correctly, this should work.

Try to turn on the debug messages and remove the @ in from of the mail() function. - That might generate some error messages to help debug this.
Apr 1 '10 #2
taurus89
6 New Member
it will display error message like this...
Warning: mail() [function.mail]: "sendmail_f rom" not set in php.ini or custom "From:" header missing in C:\xampp\htdocs \proj_prktkl\li st_extract.php on line 19
msg not sent
Apr 1 '10 #3
Atli
5,058 Recognized Expert Expert
You are missing the the "From" address.

It can be set like the error message describes, in the php.ini configuration file, or you can do it manually by adding a custom From header. (See example #2 in the manual entry for the mail function.)
Apr 1 '10 #4

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

Similar topics

5
4414
by: nate heaton | last post by:
I would like to do the following with C# in my asp.net app: Open the default email client of the user (just like a mailto: link would). Supply the subject line and put some HTML (including an image) into the body of the email. Any help would be greatly appreciated. -- Nate Heaton
0
3715
by: David Burson | last post by:
Hi, I have a VB.NET windows app that needs to automatically send a simple text email when my users run a new version of the app for the first time. I thought this would be simple, but after days of reading posts and testing, I see it is not - unless I'm missing something? I'm not an email guru. All of my users will be running at least Windows 2000, most on XP sp2. Some of my users will have Outlook, many will be using Outlook...
1
5349
by: Jay McGrath | last post by:
Help - trying to send a simple text email with with as little user intervention. I am trying to create a button in my Access application that will automatically send a simple text email. It works except that I have two warning nuisances: 1) Program is trying to access email Addresses you have stored in Outlook. Allow access for ... 2) A program is trying to automatically send email on your behalf ... Heck, I am only trying to a send...
0
1726
by: jjalexrayer | last post by:
How do send mail automatically in asp.net? Public people can register in my website. after registering system will send email every 10 days reports without any admin actions(that means automatically send mail). Can anyone help me? Thanks, J.Alexander.
11
22390
by: fdu.xiaojf | last post by:
Hi, I just want to send a very simple email from within python. I think the standard module of smtpd in python can do this, but I haven't found documents about how to use it after googleing. Are there any examples of using smtpd ? I'm not an expert,so I need some examples to learn how to use it. Or maybe there is a better way to to this?
6
22819
by: mattc | last post by:
Hi, Writing a Macro in Excel and wanting to send emails automatically without this pop up box "A program is trying to automatically send email on your behalf". Is there some script I can use to avoid this pop up ? I'm just a beginner.... please help. Thanks !
0
1192
by: manontheedge | last post by:
I'm trying to automatically send emails through VB, through Microsoft Outlook 2003, but get the security message ... "A program is trying to automatically send e-mail on your behalf. Do you want to allow this?" which means, I have to be sitting at my computer at the time I want the email to "automatically" send. I've searched the Internet, and all I found was software to install to fix this problem. I don't want that. I'm wondering...
7
1607
by: canajien | last post by:
How can I get a php page to automatically send all the contents in an email when it is generated? I managed to hack together a script that sends an email, but it will only send the 1st record returned and I would like it to send all the records that are on the page when it is loaded. <?php $con = mysql_connect("localhost","user","pass"); if (!$con)
2
9877
iBasho
by: iBasho | last post by:
Hi, I am trying to set up a notification email that would come to my email everytime users click on a command button in a form. I am using the DoCmd.SendObject command without actually sending any database objects. Private Sub Command107_Click() On Error GoTo Err_Command107_Click DoCmd.SendObject acSendNoObject, , , "email@email.com", , , "Test", "Email Test", , True Exit_Command107_Click: Exit Sub
3
6640
by: phill86 | last post by:
Hi I am using the following code to send an email from access via outlook automatically DoCmd.SendObject acSendReport, stDocName, acFormatRTF, "User", , , , , False
0
9722
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10643
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10391
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10121
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9200
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7664
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3862
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.