Jump to content

Sending Emails To Entries In My Database

Recommended Posts

Using PHP/mySQL


Have a database of registrants and one field is their email address.Want to allow event director to log in to a secure area, fill out a form with the message and be able to send the message to all the registrants to his event.


I created a form with 2 fields. From address (this will be the event director's address) and a text field for the content of the email. These are sent to the variables $eventdirectoremail and $body.


2 issues:


1. paragraphs are not kept, when the confirmation page comes up all text just runs together.

2. I want to use the following general format. I can get the data from the database no problem into the variable $emailaddressesfromdatabase. The $eventdirectoremail and $body are grabbed from the form.



$headers = "From: $eventdirectoremail\r\n";

$headers .= "Reply-To: $eventdirectoremail\r\n";

// $headers .= "To: $eventdirectoremail\r\n";

$headers .= "bcc: "$emailaddressesfromdatabase"\r\n";

$headers .= "MIME-Version: 1.0\r\n";

$headers .= "X-Priority: 1\r\n";

$headers .= "X-MSMail-Priority: High";


$mail_subject = "Subject is here";


$mail_body = "$body\n";

mail("$email", $mail_subject, $mail_body, $headers, "-f".$eventdirectoremail);


not being sent, any ideas?

Link to post
Share on other sites
  • 2 weeks later...

Re: the problem with the lines running together, make sure there's a nl2br($body) in there somewhere.


As for e-mails not sending, I'm having the same problem. Whether I set e-mails to be sent to each DB address separately or add them all as Bcc's, some addresses get the e-mails and most don't.

Link to post
Share on other sites

I have looked further into this and found out that DADA mail is ideal for me. I have installed it and set it to use a mysql backend for the email addresses. A little tweaking of the conifg.pm file to remove some options on the list page and I can let my event directors log in and send an event update to registrants without fear of them editing the list properties.


--- settings removed ---


Thanks for your suggestions.





Edit: TCH-Bruce - settings removed to prevent spammers from catching on

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...