473,327 Members | 1,952 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,327 software developers and data experts.

PHP srnd two emails

Hi at all

I call this function when I fill the foot of the body of the email that I'll
send immediately after:

$text.=serial_number();

function serial_number()

{

$file="serial.txt";

for ($try = 0; $try < 5; $try++)

{

$fp = fopen($file, "a+");

if (flock($fp, LOCK_EX)) { // do an exclusive lock

fseek($fp, 0);

$id = fread($fp, 1024);

$id++;

ftruncate($fp, 0);

fwrite($fp, strval($id));

flock($fp, LOCK_UN); // release the lock

break;

}

else

{

sleep(1);

continue;

}

}

fclose($fp);

return $id;

}

The email is sended better and into the last line of the body there is the
new serial number

BUT......... IMMEDIATELY AFTER is sended a second EMPTY email without body
that contain only the serial number (new)

Please where wrong I?

Thank you very much in adbance

Pablo
Jun 27 '07 #1
3 1268
On Jun 27, 9:50 pm, "Pablo" <p...@nospam.comwrote:
Hi at all

I call this function when I fill the foot of the body of the email that I'll
send immediately after:

$text.=serial_number();

function serial_number()

{

$file="serial.txt";

for ($try = 0; $try < 5; $try++)

{

$fp = fopen($file, "a+");

if (flock($fp, LOCK_EX)) { // do an exclusive lock

fseek($fp, 0);

$id = fread($fp, 1024);

$id++;

ftruncate($fp, 0);

fwrite($fp, strval($id));

flock($fp, LOCK_UN); // release the lock

break;

}

else

{

sleep(1);

continue;

}
}

fclose($fp);

return $id;

}

The email is sended better and into the last line of the body there is the
new serial number

BUT......... IMMEDIATELY AFTER is sended a second EMPTY email without body
that contain only the serial number (new)

Please where wrong I?

Thank you very much in adbance

Pablo
try showing us the code that does the emailing, rather than the code
that tries 5 times to add a serial number to the end of a string.

Jun 28 '07 #2

"shimmyshack"
wrote
>
try showing us the code that does the emailing, rather than the code
that tries 5 times to add a serial number to the end of a string.
<?PHP

function serialize()

{

$file="serial.txt";

for ($try = 0; $try < 5; $try++)

{

$fp = fopen($file, "a+");

if (flock($fp, LOCK_EX)) { // do an exclusive lock

fseek($fp, 0);

$id = fread($fp, 1024);

$id++;

ftruncate($fp, 0);

fwrite($fp, strval($id));

flock($fp, LOCK_UN); // release the lock

break;

}

else

{

sleep(1);

continue;

}

}

fclose($fp);

return $id;

}

$mail_text="Dear Sirs,\nthis is my question for you...........\n\r";

$mail_text.=$_REQUEST['body_of_question']."\n\n";

$mail_text.="Serial n.".serialize()."\n\n";

$mail_subject="Questions";

$mail_to=$_REQUEST['mailto'];

$mail_from=$_REQUEST['_mailfrom'];

$sended=@mail( $mail_to, $mail_subject, $mail_text, "From:
{$mail_from}\n" );

?>
Jun 28 '07 #3
"shimmyshack"

wrote
>however you are encouraged to use PhpMailer
or some other email class tp send your mail.
Please how can I understand if the PHP version that work into my web site
support PHPMailer?

And if it do not support PHPMailer what can I do?

Thank you
Jun 28 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: simonc | last post by:
I've been programming in assembler and C/C++ for a number of years, but I'm only just starting down the road of PHP & MYSQL. I have a couple of questions: (1) Before I start writing my own...
1
by: dan glenn | last post by:
I'm creating HTML emails from a PHP site and sending them out to an email list (just about 40 people so far are on this list). I've tested and confirmed that these emails work in yahoo.com's...
0
by: Thomas Mandelid | last post by:
A client I`m working for want to be able to send multiple emails to customers of their own. I have developed a simple app to accomplish this, but the application has a few flaws and I`m looking for...
4
by: ItsMe | last post by:
Dear All, I'm getting junk email with around 140-150 kb almost everyday and it my mailbox is getting full and this emails are full of virus effected attachments. And I'm getting these emails...
5
by: Kun | last post by:
i have the following code: ---------------------------------- import smtplib from email.MIMEText import MIMEText fp = open('confirmation.txt', 'rb') msg = MIMEText(fp.read()) From =...
5
by: sck10 | last post by:
Hello, I am working on a new project where I need to: 1. open an email and then create an xml file from the email 2. open the xml file and parse the information. I would like to be able to do...
5
by: Jai | last post by:
Hi, I am in a problem of sending mass emails(newsletter) to my website members. Actually my problem is this: I want to send newsletter to my website members. But I had given a facility for...
2
by: =?Utf-8?B?RGFuY2Vy?= | last post by:
Hi, I was attempting to check my new incoming emails through Outlook Express (I have Windows 98, 2nd Edition). My computer seemed to be having a problem accessing and opening the emails, and the...
0
by: =?Utf-8?B?Q2hhcmxlcw==?= | last post by:
Like many people, I normally use Yahoo! Mail via the web and like to keep all my emails stored on the Yahoo! server. However sometimes I can’t get access to a PC/the web and I download my emails...
0
by: =?Utf-8?B?UmljaA==?= | last post by:
Hello, My company will be hosting a webcast, and I need to send out 2000 individual emails to people who signed up (for login information...). I created an smtp app that I can loop through...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.