473,800 Members | 2,323 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Mailer script sends email twice

11 New Member
Hello Sir/ Madam,
I solve my problem. I can't end loop in this script. I receive two time mail. I wanna receive only one time mail.

Expand|Select|Wrap|Line Numbers
  1.  <?php  
  2.             $txtName=$_REQUEST['txtName'];
  3.             $txtEmail=$_REQUEST['txtEmail'];
  4.             $txtCompany=$_REQUEST['txtCompany'];
  5.             $txtPhone=$_REQUEST['txtPhone'];
  6.             $txtSubject=$_REQUEST['txtSubject'];
  7.             $txtDetail=$_REQUEST['txtDetail'];
  8.  
  9.             $to = "your_name@gmail.com";
  10.             $headers = "From:" . $txtEmail . "\r\n";
  11.             $headers .= "Reply-To:" . $txtEmail . "\r\n";
  12.             $headers .= "Return-Path:" . $txtEmail . "\r\n";
  13.             $headers .= "CC: your_name@rediffmail.com\r\n";
  14.             $headers .= "BCC: your_name@yahoo.co.in\r\n";
  15.             if (empty($txtDetail))
  16.             {
  17.                 echo("Please" . "<a href=http://www.xyz.com > Click here" . " to contact us.");
  18.             }
  19.             else
  20.             {
  21.                 $message = "Email sender - " . $txtName ;
  22.                 $message .= "\r\n From Company -" . $txtCompany;
  23.                 $message .= "\r\n Contact Phone -" . $txtPhone;
  24.                 $message .= "\r\n Message -" . $txtDetail;
  25.                 if (mail($to,$txtSubject,$message,$headers) ) 
  26.                 {
  27.                     $result= "Email has been sent to the customer service! We will respond to you promptly.";
  28.  
  29.                 } 
  30.                 else 
  31.                 {
  32.                     $result="There was problems sending out the email! Please click" . "<a href=mailto:your_name@gmail.com> Here to contact us";
  33.                 }
  34.             }
  35.         ?>
Thanks
Kalaram

Email addresses removed: for your own safety do not post the email in the technical forums-ajaxrand
Sep 5 '07 #1
5 2988
ak1dnar
1,584 Recognized Expert Top Contributor
Hi Welcome to TheScripts.com

You have posted this thread in the Php-Articles section , So I had to move it back to the Forum. Please use the Php-Forum for posting questions in future. Thanks !
Sep 5 '07 #2
nathj
938 Recognized Expert Contributor
Hello Sir/ Madam,
I solve my problem. I can't end loop in this script. I receive two time mail. I wanna receive only one time mail.

Expand|Select|Wrap|Line Numbers
  1.  <?php  
  2.             $txtName=$_REQUEST['txtName'];
  3.             $txtEmail=$_REQUEST['txtEmail'];
  4.             $txtCompany=$_REQUEST['txtCompany'];
  5.             $txtPhone=$_REQUEST['txtPhone'];
  6.             $txtSubject=$_REQUEST['txtSubject'];
  7.             $txtDetail=$_REQUEST['txtDetail'];
  8.  
  9.             $to = "your_name@gmail.com";
  10.             $headers = "From:" . $txtEmail . "\r\n";
  11.             $headers .= "Reply-To:" . $txtEmail . "\r\n";
  12.             $headers .= "Return-Path:" . $txtEmail . "\r\n";
  13.             $headers .= "CC: your_name@rediffmail.com\r\n";
  14.             $headers .= "BCC: your_name@yahoo.co.in\r\n";
  15.             if (empty($txtDetail))
  16.             {
  17.                 echo("Please" . "<a href=http://www.xyz.com > Click here" . " to contact us.");
  18.             }
  19.             else
  20.             {
  21.                 $message = "Email sender - " . $txtName ;
  22.                 $message .= "\r\n From Company -" . $txtCompany;
  23.                 $message .= "\r\n Contact Phone -" . $txtPhone;
  24.                 $message .= "\r\n Message -" . $txtDetail;
  25.                 if (mail($to,$txtSubject,$message,$headers) ) 
  26.                 {
  27.                     $result= "Email has been sent to the customer service! We will respond to you promptly.";
  28.  
  29.                 } 
  30.                 else 
  31.                 {
  32.                     $result="There was problems sending out the email! Please click" . "<a href=mailto:your_name@gmail.com> Here to contact us";
  33.                 }
  34.             }
  35.         ?>
Thanks
Kalaram

Hi Kalaram,

I don't see any loop in this code. Could it be that you were receiving the email twice becaus e your email address was listed twice? It's just a shot in the dark.

Cheers
nathj
Sep 5 '07 #3
pbmods
5,821 Recognized Expert Expert
Changed thread title to better describe the problem (did you know that threads whose titles do not follow the Posting Guidelines actually get FEWER responses?).
Sep 5 '07 #4
Kalaram
11 New Member
Hello Sir/ Madam,
I can't see email address list twice. plz u mark that place where i write twice mail address. Send me ASAP.

Thanks
Kalaram


Hi Kalaram,

I don't see any loop in this code. Could it be that you were receiving the email twice becaus e your email address was listed twice? It's just a shot in the dark.

Cheers
nathj
Sep 11 '07 #5
ak1dnar
1,584 Recognized Expert Top Contributor
Remove the CC: and BCC: addresses from your mail script. who knows Is there any mail forwarder enabled on your mail clients, which sends the CC or BCC headers back to your TO header.
Sep 11 '07 #6

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

Similar topics

6
7157
by: Raphael Gluck | last post by:
Hi all I am still finding my feet creating a website in ASP, and i'm trying to get to grips with users providing feeback to my site. my webhosts have the dundas mailer installed, and i am trying to get it to work for me. does it work in conjuction with regular html? can i add a <form> and text fields? and then will all that get sent with the page? I have a little script but i dont know how to modify it
5
1452
by: WoG | last post by:
I am having a heck of a problem getting this script to email correctly. A form generates all the values, and the script sends off confirmation email- except I don't get any of the confirmation emails I don't get any errors either. I've tried multiple email addresse (in network, out of network, etc.) Here is the code: set objMail = Server.CreateObject("CDONTS.NewMail") objMail.To = "jesusfreaks18@hotmail.com" objMail.From =...
8
5277
by: Dave Smithz | last post by:
Hi, Thanks to this group I discovered the excellent PHP Mailer (http://phpmailer.sourceforge.net/) which I use to send emails. Part of my application emails out hundreds of club members unique URL links which allow them to register for various things. Sometimes these URLS are long because they contain custom codes. Problem I am having is that some members are saying the links do not work
7
5156
by: Paul Marshall | last post by:
Hi I am my wits end! I have a PHP script running that captures variables posted from a form on the previous page. The script then emails the results using the mail() function. The script is currently being spammed in two ways: 1) The page is being loaded directly, therefore emailing blank results 2) The variables are made up of an accepted email address (all variables
10
3168
by: Flopper | last post by:
Hey can anyone help me with a WORKING anonymous mailer php script. I've looked on the net but only find non working one's. Greetings Floppie
4
6613
by: =?Utf-8?B?TWlrZSBI?= | last post by:
I'm using a block of ASP to allow a user to send a form via e-mail. However, someone keeps sending me spam through this form and they're using a bogus return address. I'm testing for a successful send, which should fail if the return address is not valid, but I'm still getting the junk. The block looks like this: Set Mailer = Server.CreateObject("SMTPsvg.Mailer") Mailer.RemoteHost = "smtp.xxx.com" Mailer.FromName =...
2
2023
by: kind1one | last post by:
I am green to PHP and trying to create outside PHP mailer for html form ,i found the script i need but I can't get it to upload more than one file ,since i do not know exactly where to place script request for file2-file10 as well as the exact line to place extension control and size limit ,SOS , any help would be aprishiated the mailer script: <?php if (strpos($_SERVER, $_SERVER)>7 || !strpos($_SERVER, $_SERVER)) ...
6
26389
by: Dave Kelly | last post by:
Sorry for the long post, it is easier to discard information than to have to wait for it to arrive. So here goes: This code worked perfectly when I was an Earthlink customer. Sprint decided not to pardner with Earthlink and create their own IP. Since then everything email has been broke. Sprint/Embarq is the only copper wire DSL provider where I live.
9
8257
by: neovantage | last post by:
hey geeks, I have a small mail script which will cause a PHP script to send a receipt upon clicking the submit button, by an HTML mail. This mail contains special characters, namely 'å', 'ä' and 'ö'. Whatever I try, I can't get these characters to display properly everywhere. In some email clients, these characters show up just fine, whereas in others they show up as question marks or kinda boxes. I've tried sending the mail as UTF-8, as...
0
9691
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
10276
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10035
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
9090
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
7580
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
6813
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
5471
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...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.