I must be missing something really basic, but I can't find how to configure an smtp server in simplenews..

I installed the smtp module and have it correctly sending email, so I conclude that my site is capable of sending email - but I don't see where you tell simplenews the address/login/password of your server..

thanks for any direction -

david

Comments

FreeFox’s picture

Mail is sent through an smtp server that is running outside Drupal.

e.g. When I install a Linux server I always install Sendmail with it. So Drupal, PHP and other things on my server that needs to send mail will send through Sendmail. Settings for Sendmail can not be set in Drupal nor Simplenews. You have to set them in the smtp server (Sendmail) directly.

Hope this helps.
Jan

sarcasticboy’s picture

Sorry, but this does not make sense to me, so let me back up a step..

In order to send email, a given tool needs to have information about the smtp server it is going to use; so if I am sending email from the Drupal SMTP module, or even Thunderbird, I need to specify the mail server address, port, login, and password.

When I configure the SMTP and CiviCRM modules, I tell each module all this information (smtp via the admin settings, crm via the config.php file).. somewhere Simplenews needs to get this information, but I don't see where that is..

glancing at the activeMailLib.php file, this would seem to be the relevant code..

function mkCheckServer($email){
// no validation if OS is Windows, return true
if(defined("PHP_OS") && !strcmp(substr(PHP_OS,0,3),"WIN")) return array(true, "This method is not supported on Windows systems");
list($user,$domain) = split("@",$email,2);
$mxlist=false;
if ($this->checkserv){
@getmxrr($domain,$mxlist);
$result=array(false,$domain." Mailserver not found");

I don't fully understand this, but perhaps it is trying to consider the newsletter subscriber's email address as a viable smtp server?

I just need a way to tell simplenews to use my ISP's email server using a specific login/password (just like the smtp module does)

I should mention that I am using the 4.7 version of simplenews - I don't think 4.7 has been patched to use mimemail?

thanks

FreeFox’s picture

I'm working with D5.1 and mimemail. My server has an smtp server running on localhost port 25. Not problems there. There are some settings in the php.ini file that could work for you:

[mail function]                                                                                                                     
; For Win32 only.                                                                                                                   
SMTP = localhost                                                                                                                    
smtp_port = 25                                                                                                                      
                                                                                                                                    
; For Win32 only.                                                                                                                   
;sendmail_from = me@example.com                                                                                                     
                                                                                                                                    
; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").                                                     
sendmail_path = /usr/sbin/sendmail -t -i

If not, have a look at this node: Relay SMTP mail to external mail server using smtp.class

Hope this helps
Jan

sutharsan’s picture

Status: Active » Fixed
sarcasticboy’s picture

Thanks to jandoemen for the ideas and link to the external relay thread.. sadly this ended up not working because it still required access to the php.ini (which was the original problem)..

I ended up crafting a different solution and wondered if anyone might see a problem:

I altered the mail send method (sn_mail_send) to use the SMTP module instead of using activeMail.. I had ported the mimeMail stuff back from the drupal 5 version, but it didn't help and I really don't get mimeMail (it looks for $module .'_mailengine' functions) so I looked at SMTP which was able to send test emails for me - bypassing the php mail settings. Here is the code

function sn_mail_send($mail) {
$from_email = variable_get('site_mail', 'myMail@myHost.org');

$headers = "From:$from_email\nReply-To:$from_email\nX-Mailer:Drupal\nReturn-Path:$from_email\nErrors-To:$from_email\nContent-Type:text/html";

return user_mail($mail->to, $mail->title, $mail->message, $headers);
}

this is largely stolen from the user.module and relies on the user_mail_wrapper technique.. to make this more official, you would wrap it in a "if (module_exist('smtp'))" block..
note that the Content-Type bit in the headers string is required to force SMTP to do HTML emails.. if this is missing, it defaults to plain text.

so far, this sends perfect test newsletters via the email gateway configured in the SMTP settings..

red flags from anyone? is it worth adding the ability to send via SMTP in addition to mimeMail?

Anonymous’s picture

Status: Fixed » Closed (fixed)