SMTP Mailer

By far the majority of requests for help are still something to do with emails – mainly not sending! This is normally down to server restrictions that are based on limitations to recipients per email or time based choking.

One potential way around this might be to channel your emails via an SMTP server so the plugin below might be worth a try. Amend the plugin code below with your smtp server, your usewrname and password. Upload it and activate it then try sending your notifications. If it works send some kudos (or hard cash) my way! :D

<?php
/*
Plugin Name: SMTP Mailer
Plugin URI: http://subscribe2.wordpress.com
Description: Allows wp_mail() to send via SMTP server.
Version: 1.0
Author: Matthew Robinson
Author URI: http://subscribe2.wordpress.com
*/

/*
Copyright (C) 2006-8 Matthew Robinson

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

http://www.gnu.org/licenses/gpl.html

*/

/*
Instructions
1/ Change 'smtp.domain.com' to the server name of you out-going email server
2/ Change 'my_username' to your email mailbox username
3/ Change 'my_password' to your email mailbaox password
4/ Save this file and upload it to wp-content/plugins, then activate the plugin as normal
5/ Test is works by emailing a notification via Write->Subscribers in the Subscribe2 plugin
*/

add_action('phpmailer_init', 'wp_mail_to_smtp');

function wp_mail_to_smtp(&$phpmailer) {
	$phpmailer->Mailer = 'smtp';
	$phpmailer->SMTPAuth = true;
	$phpmailer->Host = 'smtp.domain.com';
	$phpmailer->Port = '25';
	$phpmailer->Username = 'my_username';
	$phpmailer->Password = 'my_password';
}
?>
About these ads

106 thoughts on “SMTP Mailer

  1. Ok, I gave this a try using the following settings –


    function wp_mail_to_smtp(&$phpmailer) {
    $phpmailer->Mailer = 'smtp';
    $phpmailer->SMTPAuth = true;
    $phpmailer->Host = 'smtp.gmail.com';
    $phpmailer->Port = '465';
    $phpmailer->Username = 'user';
    $phpmailer->Password = 'pass';

    but no luck. The message shows as sent, but no emails are rec’d.

  2. Sorry for the second post, but I have also tried the plugin with a different smtp server and settings with the same results.

  3. Ok, tried it with the ssl line you gave me, but still no emails. Checked gmail and nothing is there.

    I remembered seeing a screenshot of the gmail settings on the shiftthis site (from the smtp plugin link you have in your sidebar) which shows tls not ssl. Tried changing ssl to tls, but that did not work either.

    Finally I tried the smtp info for the account the email is being sent from (which is not gmail) and did not get anything using those settings either.

    **completely different question, but why can’t I highlight and copy from your comments? No big deal, just curious.

  4. Marilyn,

    I’ve tried the above on one of my blogs and it worked – it might be a case of playing around with the settings and checking that your host isn’t blocking outbound traffic on ports 25 and 465.

    As for the copy and paste question – it works for me in Safari 3.1.1. What browser are you using?

  5. Well, I’ve tried everything I could think of and nothing worked. I’ve used 3 different email accounts using 4 different smtp servers (1 was a relay server if that makes any difference) and using 3 different ports.

    I finally called the host who actually confirmed that using the mail() function makes the mail go out through their relay server directly and therefore increases my limitation to 1000 per day instead of 250. So, I’m actually good now.

    At this point I’m willing to try something else for you if you like since I have some time before the site actually goes live, but I’m out of ideas.

    Regarding the c&p – I should have known it wasn’t done on purpose! Tried it on firefox ok, but apparently it doesn’t work in Avant (IE basically).

  6. Marilyn,

    It may be that your host is only allowing web traffic on port 80 and blocking all other ports. At least you now know that you can get your site working by using the relay server. Thanks for you feedback – this little plugin may help some but obviously not all!

  7. Whether the Subscribe plugin is supposed to work with WP 2.5 doesn’t really matter if it isn’t. I have used the plugin for over 2 years throught WP versions 1.5 and up through 2.3. There is something relative to the 4.6 version and WP 2.5. It is a shame as the plugin is a ‘nice’ tool. It has become relied upon as a part of the WP installs, almost as though it is a part of WP.

    Since I see a ‘work’ around, I am at least encouraged the plugin authors at least have an interest in making it work. Too often plugin users are pretty much left to flounder if one fails. Too often, there is no support to be found. I guess I will give it a try and try to report back. If I could report where it is breaking down, maybe I could provide insight for you to fix. I don’t believe its failure has anything to do with hosting environments, especially when the hosting enviroment remains unchanged as the WP and plugin updates are applied. WP V.2.5 may be a major upgrade but I believe it has also left a lot of plugin functionality in question.

  8. This is an add to the previous comment. The work around instruction doesn’t specifically state what to name the added plugin file. I have used wp_mail_to_smtp.php with the hope this is correct

  9. Martin,

    It doesn’t matter within reason what you call the plugin file so what you’ve called it will do just fine.

    I have applied some fixes to Subscribe2 for the next release that have been discussed on the comments but I am also working on getting Subscribe2 working with WordPressMu so that is holding up release.

    There are still some issues with different hosts and the way the attempt to manage spam on their servers. This WordPress ticket shows that the problems affect the WordPress core and not just Subscribe2!

  10. Could you clarify on the changes you’re implementing for WordPress MU?

    We’ve been using the plugin here in a WordPress MU installation and up until now we thought it was running smoothly.

    Unfortunately we’ve discovered an issue whereby people are not receiving emails. According to the server logs the emails are not being sent. In essence some subscribers are getting emails, and others are not.

    Would it be possible to get a pre-release / testing copy of the plugin to see if your changes resolve our issue?

  11. TechExplorer,

    Some of the SQL searches that return registered users are collecting details for ALL registered users and not just those signed up to a particular blog. I think this is about the only area where Subscribe2 is not 200% compatible with WPMU.

    A dev version is available with the changes added in. I’ve also slightly amended the construction of the email headers now I’m using wp_mail again.

  12. Thank you very much for this version. We’ll test it in the morning here and let you know what we discover.

    Many thanks for your continued hard work on this plugin. It is essential to our project.

  13. Is there any way to get a log of the emails that went out? I checked with my host and they have no access (or won’t give me access) to the raw data logs. I’d really just like to see if all the emails went out and if anyone received dupliates, basically for my own piece of mind I guess. If there is no way with sub2 can anyone suggest a plugin that would possibly give me this information?

    Thanks!

  14. Marilyn,

    If you are hosted on a Unix platform you want to see /var/log/maillog or /var/log/exim_mainlog. Subscribe2 doesn’t do any logging and I’m not aware of a plugin that does log email. The problem is that the PHP mail() function may report that an email has been sent successfully but it’s only been passed off to a local server that drops it immediately. This sort of thing would only ever be recorded fully in the server logs specified above.

  15. Unfortunately, that’s the response I was expecting from you, I guess it was wishful thinking that there would be another way to get that information. Oh well.

  16. Matthew:

    I am so sorry to tell you the Subscribe2 Plugin does not work with WP 2.5.1. I have had several BLOG sites ‘blown’ up because the Subscribe2 plugin does not work.

    After trying many different things, including the incorporation of the SMTP mailer, I created a NEW BLOG. I exported from the OLD BLOG, imported into the new BLOG and still do not get Subscribe2 functionality. As much as I don’t want to go backward, in order to use Subscribe2 it appears I either have to go to an earlier verison of WORDPRESS or find a different Subscribe Plugin.

    As much as everyone seems to like ‘Open Source’ and FREE there are many plusses for having product that works and had support when needed.

    Any suggestions or thoughts?

    Martin D. Margheim

  17. Martin,

    Much as I accept your issues I can’t agree, I am running Subscribe2 on my site with WordPress 2.5.1 so it does work. It just doesn’t work for you – that’s different.

    So, what doesn’t Subscribe2 do that you expect? Do the admin pages appear? Does the Subscription process work? Are emails going missing totally? Have you asked your hosting provider about email limitations?

    Finally, I’ve had this plugin downloaded over 30,000 times and judging by comments made on here I provide a much higher level of support than other plugin authors. Despite this I get very few donations. I therefore can’t really imagine many WordPress users wanting to pay for support :-)

  18. WordPress 2.5.0 and subscribe 4.5 do not seem to play well if you are trying to use a SMTP server.

    We are running a Windows 2003 server, but I had a work around when I was using WordPress 2.1 and Subscribe2 1.6, but it was hard coded into the plugin to connect to the SMTP server.

    1. Emails are generating for the Write > Subscribers
    2. Emails are generating for signup
    3. Emails are simply not being sent. There is no limit on # of BCC or number of emails to be sent from our email server. Previously this did work with older WordPress and older subscribe2 plugin.

    Thanks for any other ideas.

  19. Sorry the above post was meant to say emails are not going to subscribers on Post submission. Very odd.

  20. Many thanks for the development version. We implemented it this morning and we are now seeing emails being sent by the blog to over 1100 subscribers and registered users.

    I have noticed one other issue.

    As I indicated earlier we’re using WPMU for our system. In our testing we had two blogs on the system that had the subscribe2 plugin enabled.

    I use the same user to login to both blogs. I noticed this morning that my subscription preferences in one blog overwrites my preferences in the other. For example

    1. Login to blog A as my user
    2. Subscribe to all categories
    3. Logout of blog A
    4. Login to blog B as my user
    5. Subscribe to all categories in this blog
    6. Logout of blog B
    7. Login to blog A again
    8. My preferences are now gone

    Any thoughts you may have would be greatly appreciated.

  21. TechExplorer,

    Thanks for your testing, I obviously still have a little work to do in getting Subscribe2 WPMU compatible – bear with me and I’ll let you know when I’ve patched the code.

  22. Yes, I understand the email has changed since 2.5 and 2.1 of WP. However, right now the plugin is not working on my Windows 2003 server when trying to use a SMTP mailer.

    I am missing something, I guess. As far as I can tell, WP 2.5 does not have a default SMTP setup under settings, plugins or anything though. It relies on mail() to send everything.

    I have tried using WPPHPMailer plugin, the newer Control SMTP plugin, and now also this SMTP plugin. Those work great for standard emails, just not the subscribe2 plugin.

    If I disable all three plugins, then no mail is sent for anything, no subscription links, no testing emails. If I enable any of the three plugins, I can send subscription links and testing emails via the Write > Subscribers. However, none of them will send the posts once a post is made. I don’t think its a SMTP server issue as I have tried it on both our server and another server too that we can connect with.

    Any ideas?

  23. Actually, I have uncovered more.

    1. Confirmation Emails are Sent.
    2. Write > Subscribers are NOT sent (except they do send one email to the admin)
    3. Posts are NOT sent to subscriber list.

    I mistakenly thought that Write > Subscribers was sending, but realistically it was onyl sending to my admin address. Thanks for any help, but perhaps its a BCC issue, since single emails go through, but multiples do not.

  24. Will try that now. If not, I am just going to port this over to a Linux server and be happy there. I can do a transfer in less than a half hour. :)

  25. FYI, I got this error when trying to activate:

    Plugin could not be activated because it triggered a fatal error.

    Parse error: syntax error, unexpected ‘?’ in D:\website-directory\name-of-my-domain\wp-content\plugins\subscribe2\subscribe2.php on line 2292

    The line that throws the error is

    $now = ?current_time(‘mysql’);

    Perhaps I should change the ? to a $ if its a variable.

  26. Just wondering in line 317 I see this:

    $newheaders = $headers . “$bcc\r\n”;

    I remember back in the old version we were getting errors with \r\n issues. Perhaps that line should be

    $newheaders = $headers . $bcc . “\r\n”;

    or perhaps use semicolns instead of new line tags. Not sure, just throwing out ideas.

  27. Peter,

    Not sure how that line got messed up, it should be:


    $now = current_time(’mysql’);

    I hope you have better luck with Linux! :D

  28. Many thanks for the updated version. I tested it using the scenario I outlined above and the subscription preferences stayed in both blogs.

  29. Got it working on Linux. Is there any possibility of using HTML to code a nice HTML newsletter template? In our previous system, we hand modified the Plugin to create an HTML template with graphics and everything. I was hoping we could put that code into the Settings box, but unfortunately it just kicks out plain text.

    Just wondering if this supports the ability for email templates.

  30. Peter,

    Glad it works on Linux – that’s Windows for you :D

    You can get HTML to work by hacking the code yourself or sending me $40 and I’ll send you the amended code.

  31. Just FYI, when creating HTML newsletters with HTML / CSS code, make sure to remove ALL whitespace when cutting/pasting into the Email Template under Settings > Subscribe 2. If you keep regular expression line breaks and plain text, it is interpreted as when inserting into the database and therefore corrupts the final output.

    So in short, create your newsletter, put in the TITLE / POST and other tags. Then remove all whitespace and line breaks. Cool.

  32. I have been getting the administrative emails when I post but not the ones to registered users. I have used a category with the email posts, and the test email posted in a different blog here worked fine. I emailed my hosting provider (GoDaddy) about hosting issues with it, but they said there were no problems on their end and to check with you guys. As far as I can tell I’ve done every solution I could find on this forum. I am using WP 2.5.1 with S2 2.4.7. Any suggestions would be great :)

  33. Hmmm… It doesn’t seem to work for my hosting through HostiCan.com. My list got up to 98 subscribers this week, then stopped working. Any way to have the next release send notifications 25 or 50 per hour… or user-configurable in Admin?

  34. Benson,

    Not by default, and it would take some extensive code changes too. I guess you could ask you host to up your limit or try hacking Subscribe2 to work with a PEAR package.

  35. Not working for me either. My host has a limit of 50 emails sent at one time. :(

  36. I’ve been trying to track down why this isn’t working for me. I’ve tried the SMTP mailer plugin, but the issue for me does not seem to be with SMTP vs command line, but rather with the way that the message itself is constructed/interpretted.

    Somehow, the Subscribe2 Bcc headers are not being recognized as such by my mail server (Exim 4.68).

    When I send a mail, I receive the copy which is sent “to” me, but no one in the Bcc line receives a copy. When I look at my exim logs, I see no attempt to deliver to the Bcc addresses. When I look at the full headers (message source) of the copy I receive, the BCC line is there (which is also odd, as it should not be if the server recognized it as a BCC) but it always appears “sandwiched” between to MIME-version lines (which isn’t where recipient info is expected).

    I own my server, so I have not set any restriction on my account for outgoing SMTP or BCCs. I can send them through a normal client or through the command line with no problem.

    Has anyone else seen this behavior? I’m going to play around with a few ideas for fixing it, but if someone else has done it I’d surely rather not re-invent the wheel!

    Thanks in advance!

  37. Jenni B,

    Have you tried switching the instances of @wp_mail to @mail in subscribe2? At present the plugin calls the inbuilt mail functions in WordPress, perhaps if you bypass these functions it might work for you.

  38. This plug in worked for me. Im using wordpress 2.5, I had to change smpt.domain.com to mail.domain.com and I also had to make sure my user name was correct for my host, I used email address with a plus sign instead of the @ sign (name+domain.com) and I used the copy to clipboard link out of safari and pasted into bbedit, then saved the file as wp_mail_to_smtp.php (someone else suggested the name above) Im posting all this for other novices that may be confused.

  39. I am thinking of using this plugin to maybe replace the free version of groupmail + gmail apps. For about 1000 addresses. However, i wont to centralise everything.

    really worried about posts been blocked

    I presume BBClimit breaks posts down into batches, is it possible to define a pause time between ?

    regards

    Andrew

  40. One more question will this filter duplicates in address import?

    Andrew

  41. Andrew,

    BCClimit does break the posts down into batches but there is no feature to pause between each post by default.

    Also, it would depend on how you ‘import’ the emails but there would be ways to avoid duplicates.

  42. Thanks

    I suppose this depends on how you import addresses

    but does the import send out optin messages ?

    I wont to import addresses -> remove duplicates -> send out optin message

    So i can make sure theres one email address (as we have spouses using same) and its verified

    i could probably code something to directly add address via sql and/or call functions within subscribe2 (later would probably require some assistance)

    Andrew

  43. Andrew,

    If you can produce an array of your email addresses (in chunks if needed) then pass each address through the Subscribe2 add() function it will add each address (skipping duplicates) to the database as a Unconfirmed subscriber.

    Then in Manage->Subscribers you can send a reminder to them all which is essentially your opt in notice.

  44. Many thanks

    I will try that i have a dummy wordpress site that i can use for testing.

    This is great as its for a non-profit club and i didnt really wont to buy a solution

    importing addresses from the membership system to group mail was a nightmare, basically i was having to remove failing addresses manually all the time

    I think i could automate the lot via a script or two at each end

    Andrew

  45. I am having the exact problem Jenni B is having above. It`s strange that I receive the email including all the BCC’d addresses. The BCC’d people never get the message. I also think something may be wrong in the construction of the message. I have to use a SMTP server so I am using the WP-Mail-SMTP plugin. I might try disabling that one and install the plugin above.

  46. Derrick,

    If you can see BCC header information then it would seem that your server mail solution is poorly configured. This could also explain the non-delivery of your subscriber emails.

  47. Hello Matt,
    I am trying the SMTP mailer, but I get this error just after pressing “publish” in my article window:

    Warning: Cannot modify header information – headers already sent by (output started at /home/mhd-01/www.tecnopolis.eu/htdocs/blog/wp-content/plugins/SMTPmailer.php:50) in /home/mhd-01/www.tecnopolis.eu/htdocs/blog/wp-includes/pluggable.php on line 694

    could you help me?
    many thanks, Alex

  48. Alex,

    How did you download the code? If you copied it to a clipboard make sure there is no white space at the top or bottom of the code.

  49. Dear,
    Facing the problem of being unable to send out more than a few emails (while i need to send out 1000+ )

    Host cannot change the relay of 250 emails.

    I want to use the description above, however I am not sure which file to modify the code on? is it the subscribe2 plugin or is it somewhere else?

  50. Also, should I change fields (oradd fields) to control what is displayed in the email sent through another SMTPserver?

    To explain more. I have a yahoo plus account with a yahoo username, password, and address. Yahoo allows me to identify the From field in the email as well as to allow me to send with an email address other than the Yahoo email address (after conducting the necessay verification)

    So I am thinking of using the Yahoo smtp server to send my emails. The problem I need to resolve is that I need to control the email address shown in the email i sent and to make it look like admin@mydomainname.com rather than my yahoo email address.

    How can i control that with thePHP code showed above?

    I

  51. Enal,

    You say your host can’t relay more than 250 emails – over what time period? If that is the limit for a day then you really need to change hosting plan.

    If it’s for an hour then you need to look at a choking solution – these are much better if they are server based so ask your host if they can help.

    If you are using Yahoo, then enter your Yahoo details in the SMTP plugin and leave Subscribe2 setting to pull the information from your blog install.

  52. Thanks,
    It says a day…Godaddy asking for USD19/month to move it up to 2000 per day.

    I think that I want to try the SMTP plugin (which is the code above) however please help me with this…

    where should I write the code above? where should i place it? in what file/directory?

    thanks

  53. Enal,

    The SMTP plugin will simply push all WordPress generated emails through an SMTP account that you own.

    If you have another account (no GoDaddy) that will allow this then copy the above code to a file and put it in your wp-content/plugins folder. Just make sure you aren’t simply diverting your emails from one problem into another!

  54. Hey
    THanks for the support I appreciate it. Actually, the reason I used WP to build the website is that I found your plugin- without it, I would have not probably used WP at all.

    Now, quick question that I need your expert support on. I already subscribed the 1000 users on my website, but now since i want to test sending out emails, I want to remove them. How can I do that in a fast way? should I use PHPmyadmin? if so, which table should I delete the records from (I do not want to use the subscribe2 interface since i have to erase one email at a time)

    thanks

  55. An interesting thing happened with me-

    The scheduled weekly email digest was sent out to all 1000 emails. however the WRITE>MAIL SUBSCRIBERS fail to be sent out.

    Why?

  56. Enal,

    The quickest way would be to use phpMyAdmin and drop the subscribe2 table providing that you only have public subscribers.

    If you also have registered subscribers then make sure you use the Bulk Management section to unsubscribe them all.

    As for why Write->Mail Subscribers didn’t work but the weekly mail did – perhaps you sent the former after the letter and had reached your server email limit. Best bet to find the answer is to ask your host.

  57. Hi, I got this recommendation from my server host one.com, since my emails are not sent.
    They do not have a limit for number of emails to go out (I have only 500, weekly digest)
    I koden ska du ändra följande:
    my-domain.se =change to own name in the code below, email address change to own email
    Anyone who understand what they are trying to say to me?
    nysida.html ska bytas till filnamnet för
    den html-fil som besökare ska se när de skickat
    formuläret.

    Namn:
    Mail:
    Kommentar:

  58. BMA,

    You need to make sure that your emails are coming from an email address on the same domain as your blog. Either change your admin user to an email addess on the same domain as your blog or hard code it in the files (subscribe2.php)

  59. From debug I can see this code
    [reg_override] => 1
    [sender] => admin
    [version] => 4.9
    [autosub] => no
    [wpregdef] => no
    [autoformat] => text
    [pages] => yes
    [password] => no
    [email_freq] => hourly
    [exclude] =>

    [reg_override] => 1
    [sender] => admin
    [version] => 4.9
    [autosub] => no
    [wpregdef] => no
    [autoformat] => text
    [pages] => yes
    [password] => no
    [email_freq] => hourly
    [exclude] =>

    In general settings admin has the email address from the domain – so this could not be the problem?

  60. It looks like the version of phpMailer bundled with WordPress doesn’t support secure connections. Hopefully this will be remedied in WordPress 2.7.

  61. Hey,
    Trying to use the dev version with smtp mailer. However some help please.

    What is authentication that the smtp server people are asking for? how do I enable that with the code above?

  62. It is not working. (write -> mail subscribers)
    Keeps giving me the following error

    Message failed! Check your settings and check with your hosting provider

    this is the case whether i use smtpmailer with an external smtp server, or not…whether iI send to registerd website users or only subscrubers.

    Current Server time is: August 7, 2008 @ 9:25 am

    Current Blog time is: August 7, 2008 @ 12:25 pm

    Current Blog offset is: 3

    No cron jobs scheduledCurrent Subscribe 2 Options are:
    Array
    (
    [autosub] => no
    [wpregdef] => no
    [autoformat] => text
    [autosub_def] => yes
    [bcclimit] => 0
    [s2page] => 0
    [pages] => no
    [password] => no
    [private] => no
    [email_freq] => never
    [exclude] =>
    [sender] => author
    [reg_override] => 1
    [show_button] => 1
    [widget] => 0
    [barred] =>
    [mailtext] => BLOGNAME has posted a new item, ‘TITLE’

  63. Sorry an update!

    Even though the error message showed, it actually sent the email (without using the SMTP mailer plugin)

    as for using the SMTP mailer, I need some help with the settings, the external smtp server requires authentication which i need your help in to place it in the code.

    Thanks

  64. Enal,

    SMTPMailer won’t work with your settings and the current version of phpMailer bundled with WordPress. THe phpMailer does not support tls or ssl connections at present.

  65. hey,
    i tried with an smtp server without authen and without ssl and it is still now wokring with the dev version of your plugin. Would it be possible for me to use a server that you use just to test sending 1 email to ensure that i have the plugin working with smtp mailer?

    email me yanal.web@gmail.com

  66. Exhausted an array of options on different smtp servers (even the smtp provided by teh host) and it just wont send (test) emails to a handful of people with the use of smtp mailer. but will send once i deactivate the smtp mailer plugin and use the subscribe2 plugin by itself.

    either 1) the code above has some error in it or that I have it placed in a wrong place
    2) or the smtp mailer does not work with the Dev version of subscribe2 on WP 2.5.1

    I would appreciate it if you can send me a name of a server that you ahve used with SMTP mailer and the smtp mailer code that you have used. If you wish, I can give you a call as well.

  67. Enal,

    Some SMTP servers ask for username/password authentication. Other specify that this must occur via SSL or TLS. The latter is not yet supporting in the phpMailer bundled with WordPress.

    I’ve updated my blogs to a newer version of phpMailer but I can’t get it working yet. I’ll post an update if I figure it out.

  68. hey,
    I tried the plugin wp-mail-smtp , you may want to use it to try to see if you can even get your site to email through smtp

    For me, it fails however this plugin gives a log of error when sending test emails. it keeps giving “ERROR: Failed to connect to server: Connection timed out (110)”

    the log is as follows:

    The full debugging output is shown below:

    object(PHPMailer)#178 (39) {
    ["Priority"]=>
    int(3)
    ["CharSet"]=>
    string(5) “UTF-8″
    ["ContentType"]=>
    string(10) “text/plain”
    ["Encoding"]=>
    string(4) “8bit”
    ["ErrorInfo"]=>
    string(44) “Language string failed to load: connect_host”
    ["From"]=>
    string(24) “admin@circassiannews.com”
    ["FromName"]=>
    string(14) “CircassianNews”
    ["Sender"]=>
    string(0) “”
    ["Subject"]=>
    string(46) “WP Mail SMTP: Test mail to yanal99@hotmail.com
    ["Body"]=>
    string(68) “This is a test email generated by the WP Mail SMTP WordPress plugin.”
    ["AltBody"]=>
    string(0) “”
    ["WordWrap"]=>
    int(0)
    ["Mailer"]=>
    string(4) “smtp”
    ["Sendmail"]=>
    string(18) “/usr/sbin/sendmail”
    ["PluginDir"]=>
    string(0) “”
    ["Version"]=>
    string(4) “1.73″
    ["ConfirmReadingTo"]=>
    string(0) “”
    ["Hostname"]=>
    string(0) “”
    ["Host"]=>
    string(12) “212.38.128.7″
    ["Port"]=>
    int(25)
    ["Helo"]=>
    string(0) “”
    ["SMTPAuth"]=>
    bool(true) (I tried with auth on and auth off with same result)
    ["Username"]=>
    string(7) “myusername”
    ["Password"]=>
    string(8) “mypassword”
    ["Timeout"]=>
    int(10)
    ["SMTPDebug"]=>
    int(2)
    ["SMTPKeepAlive"]=>
    bool(false)
    ["smtp"]=>
    object(SMTP)#4 (6) {
    ["SMTP_PORT"]=>
    int(25)
    ["CRLF"]=>
    string(2) ”

    ["do_debug"]=>
    int(2)
    ["smtp_conn"]=>
    bool(false)
    ["error"]=>
    array(3) {
    ["error"]=>
    string(27) “Failed to connect to server”
    ["errno"]=>
    int(110)
    ["errstr"]=>
    string(20) “Connection timed out”
    }
    ["helo_rply"]=>
    NULL
    }
    ["to"]=>
    array(1) {
    [0]=>
    array(2) {
    [0]=>
    string(19) “yanal99@hotmail.com”
    [1]=>
    string(0) “”
    }
    }
    ["cc"]=>
    array(0) {
    }
    ["bcc"]=>
    array(0) {
    }
    ["ReplyTo"]=>
    array(0) {
    }
    ["attachment"]=>
    array(0) {
    }
    ["CustomHeader"]=>
    array(0) {
    }
    ["message_type"]=>
    string(5) “plain”
    ["boundary"]=>
    array(2) {
    [1]=>
    string(35) “b1_e20d6de685c7e67e719b4e97699b98bd”
    [2]=>
    string(35) “b2_e20d6de685c7e67e719b4e97699b98bd”
    }
    ["language"]=>
    array(0) {
    }
    ["error_count"]=>
    int(2)
    ["LE"]=>
    string(1) ”

  69. Enal,

    I’ve been debugging this for a day or two no. I can push emails through GoogleMail from my home computer but not my webserver because of the firewall rules that are in place.

    The code I’ve posted does work as long as it isn’t blocked by a local firewall. Sadly that is of no help to you I’m sure :-( Especially as it means my SMTP server will only accept connections on the same domain!

  70. you know, even the smtp server of the host is not working. I tried the WP MAIL SMTP plugin with different smtp server accounts and they all gave the same error ERROR: Failed to connect to server: Connection timed out (110)

    I am thinking of changing hosts to get out of this problem. However I am not sure what to ask new hosts for. I mean, can you guide us on what questions to ask any potential hosts to get SMTP mailer working?

    check out my error log that i posted here
    http://www.callum-macdonald.com/2008/05/03/wp-mail-smtp-v07/

  71. Enal,

    You need to ask prospective hosts about PHP mail limitations in terms of emails per day, emails per hour and also whether you can push sendmail via SMTP servers hosted by the same provider. If the latter is true then how.

  72. Dear,
    I used the plugin WP-MAIL-SMTP and I used an SMTP Relay server of the host, and I am able to send emails through their SMTP server.

    When I use your dev version of the subscribe2 plugin, I find three things:
    1. Always get a message saying that sending failed even though the email actually goes through
    2. Hotmail accounts do not receive the messages
    3. Other accounts (e.g. yahoo, gmail) would get the message however they are all able to see the emails in the BCC field.

    Now, anyway to fix number 3 since it is the most important?

  73. Sorry, let me correct #2 problem that I found.

    Even though I pick sending the emails to public (or confirmed public) subscribers, NONE of them get it. Only Registered users receive the emails and in the BCC field of the email you find all the PUBLIC subscribers emails listed.

    thanks

  74. Enal,

    1/ Try updating to the latest dev version – I may have already fixed this. If you already are – where do you get the error message?
    2& 3/ It seems that the relay service is borking up the headers – especially given that the BCC header is visible to all. Sounds like a poor service setup to me :(

  75. ok, ill try the newest version but just before I do that….one question just to clarify, you think that you have solved the issue of subscribe2 not sending emails (through write->email) to public subscribers and only sending to registered users instead?

  76. Dear
    Hate to be the annoying person, however u asked me to test ur dev version!

    I used post notification, and the BCC problem does not exist there. So I am thinking that its the subscribe2 plugin.

    Cya

  77. Enal,

    No, in the latest version I think I may have fixed the message feedback about messages sending or not.

    I’ve had a brief look at the Post-Notification code and it is very clever indeed. It appears to add email notifications to a queuing system and this may be what is solving your issues. You may be better with that plugin.

  78. Hey,
    Moved to a new host that allows outbound traffic on port 25. Went ahead and bought a service to send smtp emaisl through authsmtp.com.

    I installed the plugin wp-email-smtp and set it up to use the authsmtp server. Testing the email works there. Checking the test email header info shows that it was indeed sent by the authsmtp.com server (not my new host)

    However, using the subscribe2 Write>email does not send out emails. I am wondering whether the subscribe2 plugin works with the WP-EMAIL-SMTP plugin or not? do you know?

    thanks

  79. deactivated the WP-EMAIL-SMTP plugin and used the code mentioned above…also no luck in sending out email.

    would it be possible to use your expertise in some consulting work to get this thing working once and for all?

    thanks

  80. I have tested the mailing feature and here is what I found so far:

    Total people on my list 11, including 2 admins

    - 6 registered users receiving the notifications just fine
    - 4 subscribers through subscribe2 are not receiving the notifications

    I am giving the SMTP fix a try, but since registered users are getting the notifications, I feeling is that the issue with the compiling of the BCC list and not the channel.

    Fadi

  81. Fzeidan,

    Excerpt emails are sent to registered users AND public subscribers at the same time and in the same email. It may be a server limit in your emails.

  82. I can’t for the life of me get this to work. The admin pages and everything show up, but no emails get sent. I have two other plugins that send email fine (WP-Status Notifier and Post Notification). So, I don’t think it’s a hosting issue. But, for the record, I’m using cPanel. Any thoughts?

  83. Mike,

    Post Notification recommends using WP Mail SMTP – are you still using that plugin?

    Both of the plugins you mention may not use the BCC header – unlike Subscribe2 – that may be the explanation. Perhaps your host is blocking emails with a BCC header.

  84. Pingback: » Using WordPress With External SMTP Server MaisonBisson.com

Comments are closed.