Вопрос

My website is able to send emails to people. Now what I would like to do next is be able to send HTML emails to people who subscribe to my mailing just like I would any other normal email and should they want to unscrubscribe, there is a link to do so. I've read up on mail chimp etc but all I want is to send the HTML emails like I would normal emails. Please any guidance would be useful.

Это было полезно?

Решение

With simple HTML you can't send emails, you need PHP or any other Server-Side programming language

Example of HTML email sending with PHP:

<?php
$to = "PUT_RECIPIENT_EMAIL_ADDRESS_HERE";
$subject = "PUT_SUBJECT_HERE";
$mail_body = '<html>
<body bgcolor="#573A28" topmargin="25">
Put HTML content here with variables from PHP if you like
Variable display Example: ' . $subject . ' 
</body>
</html>';
$headers  = "From:youremail@yoursite.comrn";
$headers .= "Content-type: text/htmlrn";
mail($to, $subject, $mail_body, $headers);
?>

to use email subscription you need a table in your database wich stores emails who subscribed to your newsletter, if a user hits "unsubscribe" you have to execute a MySQL query to remove it from your database:

table: subscribed_users(email)

SQL code to add new users to the newsletter:

INSERT INTO subscribed_users VALUES 'put_email_to_subscribe_here'

SQL code to remove users from the newsletter:

DELETE FROM subscribed_users WHERE email = 'put_email_to_unsubscribe_here'

Of course if you don't know how to use php or mysql, you need to study this two languages in order to do your newsletter subscribing.

If you don't want to learn php and mysql you can watch this page, there are some scripts that may help you, but i think you have to learn at least php in order to use them:

http://www.phpkode.com/projects/category/php-newsletter/

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top