Php reads the database content and then determines the user's registration time. How long will it take to automatically send an email?
Source: Internet
Author: User
Php reads the database content and determines the user's registration time. How long will it take to automatically send an email for reference? For example, the registration time and user name will be called after running, and the user will be automatically sent over 1 month of registration time: & lt; user name & gt; hello, you are at & lt; registration time & gt; register for this site. it has been a month since now. php has read the database content and then determined the user's registration time. an email is automatically sent more than long.
Can I provide a reference?
For example, the registration time and user name will be called after running, and the registration time later than one month will be automatically sent
User: <用户名>
Hello, You <注册时间> It has been a month since I registered this site. thank you for your support.
If you have already sent a message that is not repeated
------ Solution --------------------
This is a very simple thing. if you don't, you still won't, if someone else gives you the code.
Search the database list based on the conditions.
Send emails in the array of the loop list
Save the successfully sent User name list to the table or ID
If you don't know anything, don't do such a "complicated" thing first.
Your questions cannot be answered.
------ Solution --------------------
1. find phpmailer
2. easy time judgment.
3. add a field to identify whether to send. It's not hard.
------ Solution --------------------
$ Array = array ('passerby a' => array ('mail' => 'test1 @ 21cn.com ', 'regtime' => '2017-12-30 12:22:22 '), 'Passers-by B '=> array ('mail' => 'test1 @ 21cn.com', 'regtime' => '2017-12-30 12:22:22 '), 'passby' => array ('mail' => 'test1 @ 21cn.com ', 'regtime' => '2017-12-30 12:22:22 '));
Foreach ($ array as $ key => $ value ){
$ Sendmail-> sendto ($ value ['mail']);
$ Sendmail-> title ('expiration notification ');
$ RegTime = $ value ['regtime'];
$ MailText ="
User: {$ key}
Hello, you have registered this site at {$ regTime}. it has been a month since now. thank you for your support.
";
$ Sendmail-> text ($ mailText );
}
// Update data after sending
$ SQL = "UPDATE member SET send = 1 WHERE id IN (.....)"
Mysql_query ($ SQL );
// This is an example. you can see it clearly. sendmail is also an example. for details, see the reference of the relevant instance.
------ Solution --------------------
Discussion
Reference:
1. find phpmailer
2. easy time judgment.
3. add a field to identify whether to send. It's not hard.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.