Connecting Tech Pros Worldwide Forums | Help | Site Map

Sending email from my php registration

rock72
Guest
 
Posts: n/a
#1: Jul 17 '05
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

Dani CS
Guest
 
Posts: n/a
#2: Jul 17 '05

re: Sending email from my php registration


rock72 wrote:[color=blue]
> 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
>[/color]


Take a look at <http://es2.php.net/manual/en/ref.mail.php>.
voiceonun@syrup.bratmail.com
Guest
 
Posts: n/a
#3: Jul 17 '05

re: Sending email from my php registration


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.

Harrie Verveer
Guest
 
Posts: n/a
#4: Jul 17 '05

re: Sending email from my php registration


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:[color=blue]
> 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
>[/color]
Closed Thread