top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

Sending mail to tag followers using PHP

+4 votes
4,963 views

Question related to a internal company knowledge transfer site. Suppose there is a tag like PHP and I want to send mail to the PHP followers when a new question is posted in PHP tag?

Can i get any logic for it ?

posted Feb 7, 2014 by Seekha Dash

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+2 votes

You can use phpMailer class and whenever a question is posted then pick the follower list and send them a mail whatever you want to thats it.

answer Feb 7, 2014 by Jai Prakash
Thanks for this but as i am a fresher so can you write simple logical type query to extract data ??
I dont have your code tables etc, but try something like
1. Find out the tag say "php"
2. Get the list of followers something like "select * from tag_followers where tag='php'
3. foreach followers as follower
    {
        send the mail, refer phpMailer class
    }
Yah this is okey . But how can I perform this on q2a platform with-out hacking the core files . I think we can wright a method by overriding the 'q_post', 'a_post' or 'c_post' events . But there is a problem like if there are huge no of users , it will take time to send all the mails and then complete the required task . Is there any way so that we can send mails at  the background without affecting the core functionality .
No idea what u r talking abt
Similar Questions
+1 vote

I have used the - mail() — Send mail php function to send email from a site. Now it seems the server is blocking this for safety because I should be using authentication....

Q: mail() does not have authentication - correct?
Q: So I read from the link below that maybe I should use - PEAR Mail package .... is this a good choice to send mail with authentication?

...any suggestions for basic sending email with authentication (setup info and links also) would be welcome.

+3 votes

I need disable using of any mail command from my hosting, so I'm not sure if is sufficiently put "mail" to disable_functions in php.ini:

disable_functions = mail

I want force obligatorily use of smtp authentication, Is it enough disable "mail"? or do I need add other command to disable_functions?

i.e.: using joomla I see: phpmail and sendmail

+2 votes

Hi,

I am using phpMailer class to send the HTML email, but whenever I send the html email then at the receiving end we receive some special character (!) at random position.

We have set the charset as utf-8 and calling MsgHTML($body) to pass the body. Took an echo at the send function of phpMailer class where it is printing correctly but when looking at gmail or yahoo then we see some special characters.

MY Code

function qa_send_raw_email($charset, $fromemail, $fromname, $toemail, $toname, $subject, $body, $html, $smtp_active, $smtp_address, $smtp_port, $smtp_secure, $smtp_authenticate, $smtp_username, $smtp_password, $env=null)
{
    require_once 'php-mailer/class-phpmailer.php';

    $mailer=new PHPMailer();
    $mailer->CharSet=$charset;

    $mailer->From=$fromemail;
    $mailer->Sender=$fromemail;
    $mailer->FromName=$fromname;
    $mailer->AddAddress($toemail, $toname);
    $mailer->Subject=$subject;
    $mailer->Body=$body;

    if ($html)
        $mailer->IsHTML(true);

    if ($smtp_active) {
        $mailer->IsSMTP();
        $mailer->Host=$smtp_address;
        $mailer->Port=$smtp_port;

        if ($smtp_secure)
            $mailer->SMTPSecure=$smtp_secure;

        if ($smtp_authenticate) {
            $mailer->SMTPAuth=true;
            $mailer->Username=$smtp_username;
            $mailer->Password=$smtp_password;
        }
    }

    if ($env)
    {
        $mailer->SetFrom($fromemail, $fromname);
        $mailer->AddReplyTo($fromemail, $fromname);
    }

    return $mailer->Send();
}

Excepted Output

<p><strong>Test Data for php mailer.</strong><br\><br\>Thanks Madhu </p>

Current Output

<p><strong>Tes!t Data for php mailer.</strong><br\><br\>Thank!s Madh!u <! /p>

Any pointers.

Thanks,

0 votes

I'm using the class.phpmailer.php code to send email -- it works neat. I can send an email from my domain and it arrives almost immediately.

However, when I use the exact same code (except for the FROM address) from another domain I own, the email literally takes hours (up to 12) to arrive.

Any idea of why there is a difference of email transit times between the two domains?

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...