By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,949 Members | 921 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,949 IT Pros & Developers. It's quick & easy.

Sending email from my php registration

P: n/a
Hello there,

Can anyone tell me how to create a php script that when the user click
the Submit button, a message will be sent to friends email add stored
in mysql table?

I created this ff table structure using mysql ?

Field Type Size Description

Name Text 30 Your name
Email_add Text 30 Your Email
F_name Text 30 Your Friendís Name 1
F_name2 Text 30 Your Friendís Name 2
F_name3 Text 30 Your Friendís Name 3
F_Email Text 30 Your friendís Email 1
F_Email2 Text 30 Your Friendís Email 2
F_Email3 Text 30 Your Friendís Email3
Note: After clicking Submit Button of the Registration.Php
a message will be send directly to the email add stored in
F_Email,
F_Email2, and F_Email3 fields.

How will I do this ? What function I need to send a message directly
to this 3 emails stored in this 3 fields Iíd mentioned ? I need help
ASAP. Thanks

--
http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-email-re...ict177565.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=596658
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
rock72 wrote:
Hello there,

Can anyone tell me how to create a php script that when the user click
the Submit button, a message will be sent to friends email add stored
in mysql table?

I created this ff table structure using mysql ?

Field Type Size Description

Name Text 30 Your name
Email_add Text 30 Your Email
F_name Text 30 Your Friendís Name 1
F_name2 Text 30 Your Friendís Name 2
F_name3 Text 30 Your Friendís Name 3
F_Email Text 30 Your friendís Email 1
F_Email2 Text 30 Your Friendís Email 2
F_Email3 Text 30 Your Friendís Email3
Note: After clicking Submit Button of the Registration.Php
a message will be send directly to the email add stored in
F_Email,
F_Email2, and F_Email3 fields.

How will I do this ? What function I need to send a message directly
to this 3 emails stored in this 3 fields Iíd mentioned ? I need help
ASAP. Thanks

Take a look at <http://es2.php.net/manual/en/ref.mail.php>.
Jul 17 '05 #2

P: n/a
First, you have to have capture the Subject and the Email message body
via an HTML form. Write a PHP script and post your form to that
script. Your PHP script have to get a list of recipients from your
db table and then use those recipients in the php mail function.

Jul 17 '05 #3

P: n/a
besides the mailing part (this is explained in the replies above) I have
to say this is a very dirty way of putting things in your database. Most
of the time people use only one table so they can do easy queries and
have nothing to worry about (the idea of creating two tables with a
'relation' scares some people to death I guess). What if you ever
descide people can have more than 3 friends? You have to extend your
database table and most probably have to change a lot of queries as well.

This is a tipical example of a relation. When you can say "<something>
HAS <something>", it's a relation for 99% sure. Because one person can
have several friends, and a friend can only belong to one person, this
is a many-to-one relation (from the person point of view) (sorry for
stupid ascii-art):

---------- ------------
| PERSON | | FRIEND |
---------- 1 ------------
| name |---\ | name |
| email | \ *| email |
---------- \--| friendOf |
------------

This whould already be a much better solution. However, I quickly have
to tell (before people start flaming me :P) that this is a bit stupid. I
mean person and friend are exactly the same table. Database tables
almost always represent how things are in real life. Is a friend
something else than a person? No! A friend IS a person. The same can be
said for database tables:

------------
| PERSON |
------------ 1
| name |---
| email | |
| friendOf |---
------------ *

when a person has no friends (shit happens), leave the 'friendOf' field
to NULL or "" or something. If a person is a friend of someone, fill in
the 'friendOf' field.

In this solution, a person can be only friend of 1 person at a time. If
you want people be able to be friends with more people (many-to-many
relation) you will have to use a intermidiate table:

------------ ------------
| PERSON | | FRIENDOF |
------------1 *------------
| name |---------| person |
| email | \------| friendOf |
------------ *------------

a bit crappy this one. Both relations from friendof point to
person.name, both are oneToMany's (or manytoone's if you're looking from
the friendof table)

This way, people can have multiple friends (define and check in php if
you want to limit the maximum), and people can be a friend of multiple
people.

I hope this helps you designing your database a bit better. If you're
not used to database relations, this might be a bit of a struggle - but
eventually it will save you hours of PHP-coding on finished projects =).


rock72 wrote:
Hello there,

Can anyone tell me how to create a php script that when the user click
the Submit button, a message will be sent to friends email add stored
in mysql table?

I created this ff table structure using mysql ?

Field Type Size Description

Name Text 30 Your name
Email_add Text 30 Your Email
F_name Text 30 Your Friendís Name 1
F_name2 Text 30 Your Friendís Name 2
F_name3 Text 30 Your Friendís Name 3
F_Email Text 30 Your friendís Email 1
F_Email2 Text 30 Your Friendís Email 2
F_Email3 Text 30 Your Friendís Email3
Note: After clicking Submit Button of the Registration.Php
a message will be send directly to the email add stored in
F_Email,
F_Email2, and F_Email3 fields.

How will I do this ? What function I need to send a message directly
to this 3 emails stored in this 3 fields Iíd mentioned ? I need help
ASAP. Thanks

Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.