Emailing through php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sudip_dg77
Forum Newbie
Posts: 4
Joined: Thu Jan 24, 2008 1:14 pm

Emailing through php

Post by sudip_dg77 »

I have a mysql table called user with the following fields.

Code: Select all

 
fname       lname               email
John         Doe            john.doe@something.com
Ed      Mass            ed.mass@something.com
luke        samon           luke.samon@something.com
pal     gets            pal.gets@something.com
 

I want to design a html form which will personalized emails to each one of the members above. The html form has the follings items in the form.

Subject(a text field with the name subject)
Body(a text field with the name body)


Now I am designing a php script to be called on the submit action of the above html form which should do the following:

Pick up the first name of the person to whom I am sending the email and if the first letter of the name is in small letters change that to capital letter. Like for example in row number 3 of the table shown above the first name is "luke", which starts with a small letter "l", the php script should convert this small letter "l" to capital letter "L". So that it starts the email like as below:
Hello Luke,

How are you? This is just a test email.

Thank you.
Then the script should pick up the email address of "luke" and send the email.

Then it should move on to the next row and do the same. But if the script finds that the first name starts with a capital letter it should not convert it into capital letter and keep it as it is and send the email.

So basically I am looking for two things here:

1. Send out personalized emails to everybody in the table one by one untill the end of table is reached.

2. Before sending out the email if the first name of the person starts with a small letter then convert it into capital letter and then send the email.


Can anyone give an example PHP script to do this?

Thanks for your help in advance.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Emailing through php

Post by John Cartwright »

Are you asking for someone to do this for you? That will not happen here, sorry.

To answer your question,

swiftmailer (+ swift decorator plugin) + ucfirst()
Post Reply