Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Database/Email Script


I am no PHP programmer. At my current job I made it known that I was no
PHP programmer during the interview. Still they have given me a script
to write with the understanding that it will take me a while (This
information is just for general knowledge as I don't want anyone
thinking I am trying to be dishonest with my intentions. Also, I do not
portray myself as something I am not. I am a beginner.)

Anyway, what the script needs to do is to take variables passed from an
HTML form and do two things. One is read it into a database. The other
is to send me an email with all of the customer's information.

//Name of the script is test.php
<?php
//I am using this echo command to make sure that the variables where
passed correctly.
echo $_Post['FName']; //Never displays
//Here is where the script for the database connections starts
$username='username'
$password='password'
$hostname='localhost'
$databasename='database'
//Here is where the database connection is actually made
$conection = mysql_connect($hostname, $username, $password);
mysql_select_db($databasename) or die ("Cannot connect to
database");
//With the database connection open, I start to insert the data from
the HTML form.
$result = mysql_query("INSERT INTO table() VALUES($FName,
$LName, $Company, $Title, $Address, $Apt, $City, $State, $Zip, $Phone,
$Fax, $Email, $Var1, $Var2, $Var3, $Var4, $Var5)");
//After reading the information into the table, we close the database
connection
mysql_close();
//This is where the email script starts (Both the database and email
scripts are inside the same php tags)
$mail_to="email address";
$mail_subject = "Review Registration";
$mail_body = "First Name: $_Post[FName]";
$mail_body .= "Last Name: $_Post[LName]" ;
$mail_body .= "Company: $_Post[Company]" ;
$mail_body .= "Title: $_Post[Title]" ;
$mail_body .= "Street: $_Post[Address]" ;
$mail_body .= "Apt: $_Post[Apt]" ;
$mail_body .= "City: $_Post[City]" ;
$mail_body .= "Zip: $_Post[Zip]" ;
$mail_body .= "Phone: $_Post[Phone]" ;
$mail_body .= "Fax: $_Post[Fax]" ;
$mail_body .= "Email: $_Post[Email]" ;
$mail_body .= "Var1: $_Post[Var1]" ;
$mail_body .= "Var2: $_Post[Var2]" ;
$mail_body .= "Var3: $_Post[Var3]" ;
$mail_body .= "Var4: $_Post[Var4]" ;
$mail_body .= "Var5: $_Post[Var5]" ;..........




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Form To Email AND Database
The server I am on requires using cgiemail to send form data. I want to also send this data to a mysql database using php. Is this possible? How?

Email Addresses In Database
I've just created a login system, and everything works fine. There's only one problem that I'm faced with at the moment, and that's the update profile page.

Now when you appear on this page, the data form fields show up, containing your current username, email address, name etc. But when you click submit, it comes back with "Your email is already in use!". Yes it's in use, because the user is signed up with that address.

What piece of code would I need to add in order to update the profile without getting an email in use error?

Email Users From Database
I know how to code it all, but how should I go about emailing all users from a database?

The db has their emails and stuff.

Update Database With Data Received By Email
I d like to create a little script that check a mail box, get message and then update my progres database with data from the email. I need light on how to receive and process mail automatically.

POST To Mysql Database And Email Results?
I have a simple html form that POSTs to a mysql database. Can I, and if so, how can I, have it post to the mysql database, and email the form results too.

I also have some other html forms that just mail() the results. So I can do both things separately, but I'm not sure how to combine them.


Pulling Email Address From Database For Mail()
Maybe it's because it's late or maybe I'm just a newbie (couldn't be) but I'm having trouble with getting all the names from my database into my $to variable.

$sql_mail = "SELECT email
FROM players
WHERE email!= 'none'";
$result_mail = mysql_query($sql_mail);

//bunch of error message validation stuff...

//fetch email addresses from query
while($row_mail = mysql_fetch_assoc($result_mail)){
$to = $row_mail['email'].", ";
}
$subject = $_POST['subject'];
$headers .= "From: Me <email@site.com>";
$headers .= "Reply-To: email@site.com;
$message = $_POST['message'] . "";

//now before sticking $to in mail() now with my $headers, $subject and $message I figured that if I try that php will only include the first record.

echo $to; //returns first record as I figured.

How do I keep the list of emails from my while without having all the other stuff ($headers etc) repeat with every record?

Complicated Email Parse Or Text Extraction And Database Insertion
I am trying to strip some data out of numerous emails and place it in
my database. I know that this seems as if it has been done before.
But, this is a little different. First, the numerous emails all have a
set of data that needs to be extracted and inserted into the database.
Some of the data in the email is id, name, address, city, state, zip,
company, etc. The catch is that the date is formated and presented
differently in each email. Take into consideration the following email
examples:

- excert from email #1
ID:.............. 12345
Name:............ JOHN DOE
Address:......... PO BOX 9999
City:............ Somecity
State:........... CA
Zip Code:........ 90210 ....

Looking For A Database-driven Email "contact Manager" Application
I'm going to be collecting lots (a few thousand) email addys. Each of
these people will be interested in recieving mail on one or more
topics, with an open ended and growing number of topics. Mailman with
a BD application behing it might be ideal as it would let users add
and delete themselves and each topic would have it's own email list
name identity.

Need Email Address From Submitted Html Email Form
I have an html email that contains a form with questions for the user to fill out. Without asking the user to re-input there email address into the form, is there a way for me to grab the email address its coming from when the user submits the form to the php processing program. I need a way to match the questions to the user when they submit the form.

Email Array Checking Validity Of Email Address
I had the following working but since I changed the email variable to an array it doesn't work. email[] This is part of an edit form where emails in the mailing lists can get updated however, before they get updated i need to check that each of the email addresses are valid.But the code doesn't work for the array. Code:

Hiding The Receipeint Email Address While Sending Email
i am sending an email using php. i dont want the receipeints to see the to address. the problem is i am sending to a mailing list email address. so how can i hide the to address and the from address if possible?

Grab Email Addresses From MySQL And Send An Email....
I am making a simple mail form that will SELECT email address from a MySQL table based on the userid of the person sending the email.

if (isset($_POST['submit'])) {
require('../database.php');
$result = mysql_query("SELECT * FROM emailList WHERE merchantId = '".$_SESSION['id']."'") or die(mysql_error());

What would be the most efficient way of storing the email addresses from MySQL (may be 1 or may be 100) and then sending them in BCC to all the people gathered from the MySQL table?

Block Email Address / Domain From Using Email Form
I keep getting the same person spamming people on my website through my email form.

The email address is they keep using is sadlowski_lidia@o2.pl but this sometimes changes to a different name but still from the o2.pl domain

How can I block anyone using my email from the domain name o2.pl

Google Groups Email Spider,Auction Software, Directory PPC Search Engine Software, Email Spiders - 1
Free download full version , all products

http://netauction8.url4life.com/

Groupawy
---------------
Google Groups Email spider. The first email spider for google groups.
Millions of valid and active emails in one easy location to collect.

Spiderawy
---------------
Email spider machine. Multithreads and Multiplexed connections per
thread with built in database system for the highest scalability and
performance. Email and URL spider and extractor.

Auction software for your site
----------------------------------------
Run your own auction site in minutes. Open source code in perl. Create
your own auction site in just a few minutes. NetAuction is the
complete auction package for every business from the personal to the
corporate business. SQL database backend for the highest scalability
and performance.

Directory, Pay per click search engine software
------------------------------------------------------------------
Open source code in perl. Build your own pay per click search engine
and build your entire sites in minutes with this software. NetEngine
is turn key Pay per click search engine and content management with
built in portal tools. SQL database backend for the highest
scalability and performance.

Site builder software
--------------------------------
Open source code in perl. Build and manage your sites with the fastest
browser based site builder and content management software ever.
NetBuilder is a complete package very easy to use for building your
sites online and offline with all the tools you ever need to manage
any site of any size.

Email list manager tools, free download full version
---------------------------------------------------------------------
Full Email lists tools suite. Email Extractor, Spider emails from
online web pages, Filter lists, Merge lists, Remove unsubscribe lists
from lists, Splitter to split larg email list file to smaller files,
Deduplicator to remove duplicated emails.

Email Authentication, How To Check If Just One Email
I've a few functions to check if an email is valid. What I'm wondering is how to make sure there are only one email for each field? What we are building is a contest in which a participant can send an invitation to up to 5 friends (5 email fields), sending an invitation would give one more chance of winning the prize.

The fields are 40 characters, but how do I prevent someone from entering 2 email in the same field provided that the 2 are less then 40 characters total? If the 2 email are complete it's not so much of a problem, the participant would only receive one extra chance not two the mail function would send to both email no problem (provided the user superated them by either a space of semi-colon). But if the second email is incomplete and the user doesn't notice it then the mail admin would receive an error stating that the second email is not good...

Anyway to prevent all that I really need to make sure of 2 things.
1) that there's only one email listed in the box and
2) that the email is valid.

How To Send Email In PHP If I Do Not Have Email Server?
I have a PHP/MYSQL system on IIS. I am trying to make my system send emails but I do not know how. I do have an email server but it is not on the same machine that my PHP system is at.

How To Send PHP Email To 100+ Email Addresses
I have a script that send out html email and I have over 100 email address from people who would like to join my newsletter. But I cannot get my script to email all 100+ of these people. Any one know how I can do this? Code:

Email To Email Information Form
im creating a php form so when a user come to my website and fills out questions like "how much would you like to spend", or "the product you would like to have is". so when all the questions are filled out and the put in their email address I can get back to them. I want the php to send me the form they just sent out to MY Email Address and i need the code to send them the same email that i got so they know what they filled out and they have it for their records also.

Email A File As The Body Of Email
i have a file....:

<html>
..........
........
.........
<?php echo $USer_Name; ?>
.........
.........
........
</html>

assuming its called email.php, how would i send that file as the body of an email using mail(), coudl i do it.  and if so, how..

What Is Indexing In Mysql And How It Will Be Useful And How We Can Retrieve Database Content Easily From A Database Table Containing About 5lakhs Datas
I need to select data from a database table containing huge amount of
data. Now I am storing data using one primary key and I am just using
simple select statement, and this process gives me the output but it is
taking long to execute the query. As much I had heared I want to use
some indexing or cluster indexing which might help me but I am not so
familiar with these things.

Images In Database Vs. Image References In Database
i kept all of the uploaded images as files on the server, and created links to them in the database. I have been changing things around now (especially directories) and I am thinking of storing the images in the actual database. I read somewhere that this can be considered a bad practice, so i was wondering what the consensus here was. In my opinion, modifying all of the code to point to the correct directories everytime a page location changes seems like a pain in the a**.

Database Search -text Database...
Can anybody tell me how to search a flat file database delimited by |. I have exploded the data and managed to get it into a table but want to restrict the final table contents by a search.

The table code at the moment is below - I'd be using a htm file to submit the data. and hopefully be able to search by partial searches eg big would return big and bigfoot. Code:

PHP Email Example
I'm new to PHP and I'm trying an example from a book. This example is a small application that takes the output from a form and generates an e-mail message containing the form's contents. This is called Ex5.html :

<html>
<head><title>Example #5</title></head>
<body>
<form method=POST action=example_5.php3>
EMail Address:<INPUT TYPE=TEXT NAME="email_address"><br>
Phone Number: <INPUT TYPE=TEXT NAME="phone_number<br>
<INPUT TYPE=SUBMIT NAME=SUBMIT>
</form>
</body>
</html>

-----------------------------------
and this is called example_5.php3 :
-----------------------------------

<?PHP

$message = sprintf("Form data -----------------n");

while(list($key, $val) = each($HTTP_POST_VARS)) {
$message .= sprintf(#34>[%s]: %sn", $key, $value);
}

$message .= "n";
$message .= "More Information ------------------n");
$message .= "The user's IP address is";
$message .= getenv("remote_addr").".n";
$message .= "The user is running the web browser ";
$message .= getenv("http_user_agent").".n";

mail("bijanbel@excite.com", "Feedback Form", $message, "
From: Feedback someone@hotmail.com" );

?>
to invoke this I go to the html file with
my browser I fill out the form and submit.
then I get the following error messages :

Warning: Variable passed to each() is not an array or object in
/home/httpd/html/tests/example_5.php3 on line 5
------------------------------------
Warning: Unexpected character in input: '' (ASCII=92) state=1 in
/home/httpd/html/tests/example_5.php3 on line 6
-------------------------------------
Parse error: parse error, expecting `')'' in /home/httpd/html/sheilabel/tests/example_5.php3 on line 7
------------

>>> Does anyone have any idea how to fix this ? Some how it is not recognizing $HTTP_POST_VARS as an array but why I don't know.

PHP To EMail BCC
First off let me say I know near nothing about PHP. What I do know is
I need what it does for me.

Some time ago I purchased a little program called PHP Form Wizard to
create scripts to handle my online forms of which it does fine for me
with one exception. One of the tasks it performs is that it emails the...

ISP Email
How do you validate that an email address is ISP provided and not a free mail service.

How To Add An Email To This.
Hi, I have a form that goes to mysql when a submit button is pushed. How to make some of the form fields go to an email at the same time. For example an easy summary of it:

<?php
If post then {
?>
form fields
<form action="<?php $_SERVER['PHP_SELF'] ;?>" method='post'>
<input fields here>
type='submit' name='Submit' value='Submit'>
</form>
<?php
}
else {
$con = mysql_connect("mysql","databasename","password");
$sql="INSERT INTO etc.
if (!mysql_query($sql,$con))
{die('Error: ' . mysql_error());}

This is where I get stuck. Where to add the email fields. So that some of the above form fields will send to the email as well. I tried......
else {
$mailto = etc. and so on here.
echo "form fields sent";}}
?>

But it says unexpected Telse on the last else.

Email A Log
I dont want to actually email a log as an html attachment but instead as to extract the data from the html file and send it as an html file. I know the coding for the email using the mail function but am not sure of how touse the fopen function to open the html file and extract the data to email.

Email
I need to be able to send out emails to a fairly large number of addresses. The email content will be in HTML format or text format, depending on a value associated with each address in the MySQL table. Further, each email should display the actual recipient address in the "To: " field.

I could accomplish this easily enough for just a few emails, because the browser wouldn't have to wait long before all the emails are sent; however, this isn't satisfactory for thousands of emails.

I need to be able to process the emails in the background so that the browser isn't tied up. (Even if the browser didn't time out, it would take several minutes to send all the emails.)

Using Email With PHP
Our php was installed on our server by a consultant who is no longer
available. Now, we have just moved our servers to a new location, and
the autoresponders we have written in PHP no longer work. I'm assuming
there is somewhere in the setup that holds the ip for the email
server. Since we have a new mail server, we need to change that
setting.

Email
i want to make a webmail script but i don't know how to get e-mails from a pop3/mail server (with out deleting them).

Web Email
I would like to give users if my site free emails .. Is it better to make one or buy a ready solution ??? Does anyone know about a good email solution that i can buy ???

PHP + Email
Is it possible to have a PHP script receive an email (CSV text). The
problem is this, I want a server to send me an email, and then I want to
be able to have a PHP script 'listening' for email and then processing
the data in the email.

Is it possible to have a PHP script 'listening' or responding to an
'email received' event, so that it can process the data ?



PHP/Email
I'm working with a hosting company that blocks the user 'nobody' from sending
email.

How do I go about setting the user for sending email?

I have a "From: " header in the message.

Php Email
My goal is to be able to send email without it being constantly detected as spam.
I have no requirements for attachments.  HTML would be nice though.
Does anyone have a working basic Php Emailer? that works with gmail, hotmail and yahoo?

I can send emails using the 'mail' function.  However it is always detected as spam 100%

Email
I have made a simple newsletter for one of my customers, and have recently found out that it does not allow html. I am sure it should.. here is the code:

Email
Why do i keep getting this error:

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:wampwwwproject_upload Code:

Email?
How do you send a files through email with php?

Fax Thru Email?
We need to receive/send faxes through our laptop - fax thru email. The solution will help us receive them in a timely manner while out on the road for signed orders/contracts of an urgent nature.

Our business is not office based; so would prefer to access our faxes the same as we access our emails - ie anywhere! We can access our ISP on a wireless LAN so theoretically it should be possible to connect to our remote server (Linux hosting with Godaddy) and send/dl faxes?

Our main requirements:

1. Receive faxes thru email as binary, pdf, rtf, html etc.
2. Send/reply to faxes in the same format they were received (for compatibility)
3. Automatically send acknowledgements using a standard cover sheet.
4. Send/receive without a fixed phone line i.e. wi-fi using our laptops

Don't wish to pay setup or monthly charges for dedicated commercial fax server solutions. Could this be done with PHP? We have SMTP, Sendmail, PHP 4 + 5, MySQL on Linux, Windows XP.

Php Email
i'm trying to send an email with html. The email sends fine but I want to style it with some css code, so I added some like the following:

$message = "<style type='text/css'>
                     <!--
                      body,td,th {
                      font-size: 12px;
                     color:purple;
                     width:650px
                     }
                    a {color:blue;}
                    #img{width:180px;height:200px; float:left; overflow:hidden; border:2px solid purple; margin-left:12px;}
                    #buffer{clear:both; height:20px; background-color:white}                   
                     -->
                   </style>.....message etc

but it didnt get picked up at all, is there anyway to include css code into an html email?

Email()
I have a email smtp server with my ISP. This is the info of my email sever to use.

Email Address : megahertza@iprimus.com.au
Username : megahertza
Password : *********
SMTP Server : smtp.iprimus.com.au

How do i setup my php.ini to allow my localhost testing server to send email.

Email Form..
I have set up a cart and at the moment when you checkout all the products go to final page where you fill in your details and then press send, this is then supposed to email off to the customer and shop owner,
My question is, is there a way to get all the information in the previous page to email off using a simple form, but instead of defining every input field and the products table, have everything done automatically?

Getting Email Out Of A String
I have a string with the body of an email (from pop3).
This are "Mail delivery failed" repleys.
Now i want all email addresses out of the body.
Also addresses wich are misspelled.
Examples:
"permanent error. The following address(es) failed: xxx.xxx@yahoo.com retry time"
"permanent error. The following address(es) failed: xxx...xxx@yahoo.com retry time"
"permanent error. The following address(es) failed: xxx.xxx@yahoo retry time"
Only one Character is never in the address, the whitespace.
And only one Charcter is ever in the address, the @-sign.

Does anyone know an preg_match regular expression to do this ?

Using IIS To Relay Email
I am simply wondering if it is possible to use the mail service on IIS to relay mail generated in PHP. I can do this in ASP through CDONTS, but I can't seem to relay mail in PHP using IIS. Unfortunately I don't have a mail server anywhere that I can send the mail through.

In my php.ini I have set the SMTP server as localhost and the port as 25, and have filled in the email address that I want to send from.

Email Attachment
Hi, I'm using this script so people can email me file attachments from the web. I have read the posts here on devshed and my script should be working but the email is sent without the attachment.

Can someone please tell me where i am going wrong. Thanks.

In the previous page i have - ENCTYPE='multipart/form-data' - in the form.

From Upload To Email?
I have a simple form that collects general data (name, email etc) I have created in Dreamweaver which works fine. I have now been asked to add in an Upload File option on the same page. The files will probably be Word documents, not images. Once the file is uploaded, it is delivered straight to a private email address.

Is this possible and if so, can someone supply me with a script. I have absolutely no idea how to go about this but it has been recommended that I use a PHP script.

Array Value In An Email
I am wondering if there is a function or someway that i can put the $_POST variable in an email and not have it say 'array'.

The reaseon i am doing this is becuase when ever a cart on my store has an error i want it to email me so i can debug it better.

Email Validation
I know this question about email validation has been asked many times on here, but on all the posts i have viewed they dont actually say how to implement the email validation into the script.

Take for example the code below, how would i implement this into my PHP page?

function checkmail ($email) {
if (eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*.[a-wyz][a-z](g|l|m|pa|t|u|v)?$", $email, $check)) {
if (checkdnsrr(substr(strstr($check[0], '@'), 1), "ANY")) {
return TRUE;
}
}
return FALSE;
}

Email Encoding
I'm using the code below to send emails right now. Its is secure?

Web Based Email
I am designing a PHP-MySQL web based email and I have a question. How can I get the messages sent to a specific user. I mean how do I know if there is a new message in the mail server. And if I am doing the web-based email without POP3, how can I know when a new message arrives.


Copyright © 2005-08 www.BigResource.com, All rights reserved