Send email of new article

2»

Réponses

  • afosterafoster Member

    While it seems to work, it is sending the email only to the first subscriber in the data.txt file. In this test version of data.txt, I have three subscribers listed. Any idea why that is the case?

  • 11 sept. modifié

    Sorry, i mixed up things.

    top.php modification is to be

        if(isset($alertNewArticle)) echo $alertNewArticle;
        plxMsg::Display();
    


    Cordialement,
    gcyrillus , simple membre du forum et utilisateur de pluxml

    Mon site PluXml: https://re7net.com | Plugins: https://ressources.pluxopolis.net/banque-plugins/index.php?all_versions | demos sur free http://gcyrillus.free.fr/new | Thèmes: tester et télécharger @ https://pluxthemes.com
    Indiquez [RESOLU] dans le titre de votre question une fois le soucis réglè, Merci

  • afosterafoster Member

    OK, that eliminated the error message, but the email is still only being sent to one of the subscribers and it is shown as a bcc instead of sending it to the subscriber. There are three subscribers in the text file. Any idea why that is happening?

  • the email is still only being sent to one of the subscribers and it is shown as a bcc instead of sending it to the subscriber. There are three subscribers in the text file. Any idea why that is happening?

    not really, it probably has to do with this part :

    $pollids = "../../newsletter/data.txt";
    $contents = file_get_contents($pollids);
    $cont = explode(',', $contents); // contains number of emails
    foreach ($cont as $item) {
    $mail->addAddress($item); // Add a recipient
    }
    

    PHPMailer has this

    //Set to address
    $mail->addAddress("address@domain.com", "Some Name");
    
    //Set CC address
    $mail->addCC("ccaddress@ccdomain.com", "Some CC Name");
    
    //Set BCC address
    $mail->addBCC("bccaddress@ccdomain.com", "Some BCC Name");
    

    but you only use addAdress !? as far as you told us.

    Check what's inside in data.txt and that each email are properly written in the way PHPMailer expects it and with a , in between each records.


    Cordialement,
    gcyrillus , simple membre du forum et utilisateur de pluxml

    Mon site PluXml: https://re7net.com | Plugins: https://ressources.pluxopolis.net/banque-plugins/index.php?all_versions | demos sur free http://gcyrillus.free.fr/new | Thèmes: tester et télécharger @ https://pluxthemes.com
    Indiquez [RESOLU] dans le titre de votre question une fois le soucis réglè, Merci

  • afosterafoster Member

    Yes, the data.txt file has three subscribers with the correct formatting for an email and separated by a , after each one.
    What I want to do is send the email notification to the subscribers which are listed in the newsletter/data.txt file in this format: me@email.com,you@email.com,us@email.com,

    What needs to be changed in the sendmail.php file to make that happen. Perhaps code needs to be changed elsewhere. I have made so many changes to top.php, article.php and sendmail.php files that I'm not sure about what needs to be changed and where. am not laying any blame on you for this...this is definitely user error. Thank you again for your help.

  • 13 sept. modifié

    Did your script worked fine before putting it in ?
    Answer is probably sounds obvious to you, but i do not see how we could jam PHPMailer to send bcc mails and ignoring others ?

    It works for me btw ;(


    Cordialement,
    gcyrillus , simple membre du forum et utilisateur de pluxml

    Mon site PluXml: https://re7net.com | Plugins: https://ressources.pluxopolis.net/banque-plugins/index.php?all_versions | demos sur free http://gcyrillus.free.fr/new | Thèmes: tester et télécharger @ https://pluxthemes.com
    Indiquez [RESOLU] dans le titre de votre question une fois le soucis réglè, Merci

  • afosterafoster Member

    If you are referring to the email script I was using before you provided yours, then yes it was working. I was using the phpmailer I have though, not the one that comes with pluxml.

    Can you send me a copy of the top.php and article.php file with the changes needed? As I said, I have made so many changes that for all I know I have old code in there that could also be creating this problem.

  • 13 sept. modifié

    You have a private message :)


    Cordialement,
    gcyrillus , simple membre du forum et utilisateur de pluxml

    Mon site PluXml: https://re7net.com | Plugins: https://ressources.pluxopolis.net/banque-plugins/index.php?all_versions | demos sur free http://gcyrillus.free.fr/new | Thèmes: tester et télécharger @ https://pluxthemes.com
    Indiquez [RESOLU] dans le titre de votre question une fois le soucis réglè, Merci

  • afosterafoster Member

    I saw that and I will get back to you after I have had a chance to see if these new files will work. Thanks again for your help.

  • afosterafoster Member

    OK, taking the files you sent and specifically the sendemail.php file, it is working and I am getting the email. However, if I change these two lines in the sendemail.php file in any way, then the email is not sent. I would like to change the content of these two lines to indicate something like "A new article has been posted at puxml, see"
    $mail->Body = "".$a;
    $mail->AltBody = "".$title." - ".$url;

    With these two emails I am getting the email as you can see in the screenshot.

    You will also note, that once again the email is sent as a bcc, not to the any of the subscribers. I know that you mentioned something about the phpmailer used by pluxml, but I am at a loss as to where I need to make changes to ensure that all subscribers in the txt file are being notified.

  • 13 sept. modifié

    hello, i have no idea how you get those bcc mails. Do you have a mailbox set up to resend mails elesewhere or hidden copies ? , nothing in the scripts tells PHPMailer to add bcc recipients to your mails .

    For the parts $mail->Body & $mail->AltBody , use your own previous variable where you can insert $a for the full html link, then $title and $url for the title and url of the new article as plain text.

    :)


    Cordialement,
    gcyrillus , simple membre du forum et utilisateur de pluxml

    Mon site PluXml: https://re7net.com | Plugins: https://ressources.pluxopolis.net/banque-plugins/index.php?all_versions | demos sur free http://gcyrillus.free.fr/new | Thèmes: tester et télécharger @ https://pluxthemes.com
    Indiquez [RESOLU] dans le titre de votre question une fois le soucis réglè, Merci

  • afosterafoster Member

    I give up, it's not working and I'm tired of trying to figure it out. Thanks again for your help.

  • Sorry to hear that,

    I believe it has to do witj PHPMailer somehow https://github.com/PHPMailer/PHPMailer/wiki/Sending-to-lists

    Getting help about PHPMailer will be more efficient there : https://stackoverflow.com/questions/tagged/phpmailer

    Take care


    Cordialement,
    gcyrillus , simple membre du forum et utilisateur de pluxml

    Mon site PluXml: https://re7net.com | Plugins: https://ressources.pluxopolis.net/banque-plugins/index.php?all_versions | demos sur free http://gcyrillus.free.fr/new | Thèmes: tester et télécharger @ https://pluxthemes.com
    Indiquez [RESOLU] dans le titre de votre question une fois le soucis réglè, Merci

  • afosterafoster Member

    I know it works because I have been using a file that sends out the email after an article has been posted. The problem is that I have to enter the send file manually after each posted article instead of sending the email automatically and the email is sent to all the subscribers in the data.txt file.

    With your help it is now sending out the email automatically to include the article title and the link to the title but it won't send the email to all the subscribers. That is what is so frustrating...I know it can be done but it just is not happening.

  • With your help it is now sending out the email automatically to include the article title and the link to the title but it won't send the email to all the subscribers. That is what is so frustrating...I know it can be done but it just is not happening.

    Sorry about this. Someone else has to take over helping you. on my side the POC works and i could not reproduce your issue.


    Cordialement,
    gcyrillus , simple membre du forum et utilisateur de pluxml

    Mon site PluXml: https://re7net.com | Plugins: https://ressources.pluxopolis.net/banque-plugins/index.php?all_versions | demos sur free http://gcyrillus.free.fr/new | Thèmes: tester et télécharger @ https://pluxthemes.com
    Indiquez [RESOLU] dans le titre de votre question une fois le soucis réglè, Merci

  • afosterafoster Member

    You are not the one at fault. Out of curiosity, how many subscribers did you send it to and is the subscriber list on your site separated by commas? It probably doesn't make any difference but at this point I'm grabbing at straws.

  • 14 sept. modifié

    I tested with 4 emails adress of mine , they all got it. hotmail , sent it to spam at first untill i clicked the sender as legitime. I di d my test online from pluxopolis.net with an address set on that domain (from my local server it doesn't work at all)

    email domains tested : free.fr (yep :( ), hotmail && gmail

    based on your script . i did each email separated by a comma in a data.txt file of a single line.

    But even then, there is a trouble, if you first save your new article as a draft (email is sent) then nothing happens once you publish it for good. I think a plugin is still required to manage this case. Your case is actually giving me some hints to rewrite my newsletter plugin ;)


    Cordialement,
    gcyrillus , simple membre du forum et utilisateur de pluxml

    Mon site PluXml: https://re7net.com | Plugins: https://ressources.pluxopolis.net/banque-plugins/index.php?all_versions | demos sur free http://gcyrillus.free.fr/new | Thèmes: tester et télécharger @ https://pluxthemes.com
    Indiquez [RESOLU] dans le titre de votre question une fois le soucis réglè, Merci

  • afosterafoster Member

    Thanks for the update...I had not thought of the issue regarding saving the article as a draft. Up to this point, I have never done that.

    I didn't know you were the author of the newsletter plugin...I tried it but could not get it working. Then again I tested on my local server and that is most likely the reason.

  • afosterafoster Member

    Believe it or not, I got it to work. It is now sending the email to all of the subscribers. I found out that I had the wrong path to the subscriber list and once I fixed that, it worked. The last problem I am having is that in the email, the link to the article is not working. It takes me to https://domaincom/title-of-article, instead of https://domain.com/pluxml/title-of-article

    I assume the problem is in this line of the sendemail.php file: $a ='urlRewrite(PLX_ROOT).$url.'">'.$title.'';

    Here is the $mail->Body I have: $mail->Body = 'A new article has been posted on Dribs And Drabs, see the article name and link below.

    '.$a;
    Here is the $mail->AltBody I have: $mail->AltBody = 'A new article has been posted on Dribs And Drabs with this title' .$title.' @ '.$url;
  • 14 sept. modifié

    I assume the problem is in this line of the sendemail.php file: $a ='urlRewrite(PLX_ROOT).$url.'">'.$title.'';

    if your pluxml is in a subfolder, then you need to add it to the path:

    : $a ='urlRewrite(PLX_ROOT).'pluxml/'.$url.'">'.$title.'';
    


    Cordialement,
    gcyrillus , simple membre du forum et utilisateur de pluxml

    Mon site PluXml: https://re7net.com | Plugins: https://ressources.pluxopolis.net/banque-plugins/index.php?all_versions | demos sur free http://gcyrillus.free.fr/new | Thèmes: tester et télécharger @ https://pluxthemes.com
    Indiquez [RESOLU] dans le titre de votre question une fois le soucis réglè, Merci

  • afosterafoster Member

    Almost got it, but not quite. Here is the line I have in my sendmail.php file: $a ='urlRewrite(PLX_ROOT).'pluxml/'.$url.'">'.$title.'';
    This is the error I am getting:

    Not Found

    The requested URL was not found on this server.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

    When clicking on the article in the blog, the link is like this: https://domain.com/pluxml/index.php?article9/title-of-article

    Where is my mistake?

  • the full line creating the link should be : i should not have copy/paste your bit of code without fixing it all the way :)

    $a ='<a href="'.$plxAdmin->urlRewrite(PLX_ROOT).'pluxml/'.$url.'">'.$title.'</a>';

    With your subdirectory added it will be , https://domain.com/pluxml/title-of-article or , if urlRewriting is off , it will create this kind of url : https://domain.com/pluxml/index.php?article9/title-of-article


    Cordialement,
    gcyrillus , simple membre du forum et utilisateur de pluxml

    Mon site PluXml: https://re7net.com | Plugins: https://ressources.pluxopolis.net/banque-plugins/index.php?all_versions | demos sur free http://gcyrillus.free.fr/new | Thèmes: tester et télécharger @ https://pluxthemes.com
    Indiquez [RESOLU] dans le titre de votre question une fois le soucis réglè, Merci

  • afosterafoster Member
    15 sept. modifié

    My mistake, I posted the wrong code in my last message and my code is the same as the one you said in your last post and that is what is not working. My sendmail.php file is in the core/admin folder...does that make a difference? I assume that the urlRewrite is on because the link that is generated is https://domain.com/plux/new-article

    instead of https://domain.com/pluxml/index.php?article9/new-article

  • 15 sept. modifié

    I assume that the urlRewrite is on because the link that is generated is https://domain.com/plux/new-article
    instead of https://domain.com/pluxml/index.php?article9/new-article

    Yes and no, it depends how you did configure urlrewrite for pluxml :

    the function urlRewrite is there to create the url that matches your configuration.

    Is it a bad copy/paste of yours or did you set plux as a subfolder instead pluxml ?

    //domain.com/plux/new-article Vs //domain.com/pluxml/index.php?article9/new-article


    Cordialement,
    gcyrillus , simple membre du forum et utilisateur de pluxml

    Mon site PluXml: https://re7net.com | Plugins: https://ressources.pluxopolis.net/banque-plugins/index.php?all_versions | demos sur free http://gcyrillus.free.fr/new | Thèmes: tester et télécharger @ https://pluxthemes.com
    Indiquez [RESOLU] dans le titre de votre question une fois le soucis réglè, Merci

  • afosterafoster Member

    First of all, it was a bad copy/paste my site is set up like this: https://domain.com/pluxml/

    Also, after making the change in the admin module to enable urlRewrite, it seems to be working correctly. Hopefully we can put this to rest and I thank you again for all your help and patience. I see there is much that I have yet to learn about this application.

  • You're welcome aboard PluXml ;)


    Cordialement,
    gcyrillus , simple membre du forum et utilisateur de pluxml

    Mon site PluXml: https://re7net.com | Plugins: https://ressources.pluxopolis.net/banque-plugins/index.php?all_versions | demos sur free http://gcyrillus.free.fr/new | Thèmes: tester et télécharger @ https://pluxthemes.com
    Indiquez [RESOLU] dans le titre de votre question une fois le soucis réglè, Merci

Connectez-vous ou Inscrivez-vous pour répondre.