Forums / Cotonti / Development / SMTP

Twiebie
#1 2010-07-29 08:14
Hi,

I'm thinking about using Cotonti for a new website, but i'd like to make sure Cotonti supports SMTP by itself or maybe via a plugin. Can anyone confirm?

Thanks.
urlkiller
#2 2010-07-29 14:25
hmm its hard to give you a precise answer...

support smtp... hmm...

cotonti can send emails using the php mail() function as any plugin or php script could...

but there arn't any webmail-like plugins

edit: yet...
URL shortener: <a href="http://bbm.li/!7AD5C7">http://bbm.li/!7AD5C7</a>
ez
#3 2010-07-29 21:45
Urlkiller is right...

Cotonti is not a emailserver so 'it' can not receive email.. But you can send email..

I think you do NOT want to receive email in cotonti ???
(think about spam for a moment, you have to deal with all kinds off shit like that)

Question is: What functionality do you want ??? (PM is pretty OK...)

greetings, ez
==- I say: Keep it EZ -==
Twiebie
#4 2010-07-29 22:54
When I previously used Seditio and members received e-mail from the website the sender was: 'linux04.mywebsite.gate@mywebhostingprovider.com' instead of for example just .

So i'd like to use my own smtp address instead of the one of my host.

I can remember there was a fix for Seditio but I can't remember where it was..
urlkiller
#5 2010-07-30 05:43
if you take a look at the code.
this is the regular function to send mails in cotonti.
$headers = (empty($headers)) ? "From: \"".$cfg['maintitle']."\" <".$cfg['adminemail'].">\n"."Reply-To: <".$cfg['adminemail'].">\n" : $headers;

the $cfg['adminemail'] is set somewhere in the system. this is the sender, the server-adress of yours. you could try to fiddle with that function to get the result you want. but remember on a update you need to change the line again...

BUT i have to say that i encounter that problem on some servers too and i didnt find a way yet to fix that. i believe on some server the mail command takes the email adress of the server admin or from the useraccount, not sure here...

functions.php line 3009:
/**
 * Sends mail with standard PHP mail()
 *
 * @global $cfg
 * @param string $fmail Recipient
 * @param string $subject Subject
 * @param string $body Message body
 * @param string $headers Message headers
 * @param string $additional_parameters Additional parameters passed to sendmail
 * @return bool
 */
function sed_mail($fmail, $subject, $body, $headers='', $additional_parameters = null)
{
	global $cfg;

	if(empty($fmail))
	{
		return(FALSE);
	}
	else
	{
		$headers = (empty($headers)) ? "From: \"".$cfg['maintitle']."\" <".$cfg['adminemail'].">\n"."Reply-To: <".$cfg['adminemail'].">\n" : $headers;
		$body .= "\n\n".$cfg['maintitle']." - ".$cfg['mainurl']."\n".$cfg['subtitle'];
		if($cfg['charset'] != 'us-ascii')
		{
			$headers .= "Content-Type: text/plain; charset=".$cfg['charset']."\n";
			$headers .= "Content-Transfer-Encoding: 8bit\n";
			$subject = mb_encode_mimeheader($subject, $cfg['charset'], 'B', "\n");
		}
		if(ini_get('safe_mode'))
		{
			mail($fmail, $subject, $body, $headers);
		}
		else
		{
			mail($fmail, $subject, $body, $headers, $additional_parameters);
		}
		sed_stat_inc('totalmailsent');
		return(TRUE);
	}
}


edit: SMTP-Adress? tz tz tz, read here: http://nl.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol
URL shortener: <a href="http://bbm.li/!7AD5C7">http://bbm.li/!7AD5C7</a>
tensh
#6 2010-07-30 17:44
Make a plugin that uses e.g. a php-mailer library to send emails via SMTP.
I created a couple of plugins with this functionality for myself, I can lend you a helping hand with this. It depends on what you want. For me, I had to do the SMTP emailer (html format + attachments) with email history and the "Product reclamation system" that sends emails every time the reclamation process is updated. I used SMTP because it has the BBC functionality (hidden copies) and I could manage the bounces better.

If you need just a simple emailer, there was once a plugin made by Tefra that just mass-emails messages... it might have a bit of incompatibility with Cotonti, though.
Twiebie
#7 2010-10-01 22:59
I also had this problem when I used Seditio before I switched to Cotonti, but back then I found a topic where somebody explained a change in one of Seditio's core files and it fixed the problem with my sender being instead of the admin e-mail address.

Unfortunately that was quite some time ago and I haven't been able to find it..


Edit: Think i've found that bit.

function sed_mail($fmail, $subject, $body, $headers='')
{
    global $cfg;

    if(empty($fmail)) return(FALSE);

    require("plugins/postman/inc/postoffice.class.php");
    $PostMan = new PostOffice();
    $PostMan->IsHTML(false);
    $PostMan->FromName = $cfg['maintitle'];
    $PostMan->Subject = $psoptions['subject'];
    $PostMan->AddAddress($fmail);
    $PostMan->Subject = $subject;
    $PostMan->Body = $body;
    $res['email'] = $PostMan->Send();   
    $res['error_info'] = $PostMan->ErrorInfo;
    $PostMan->ClearAddresses();  
   
    if($res['email'])
    {
        sed_stat_inc('totalmailsent');
        return(TRUE);   
    }
    else   
    {
        return(FALSE);
    }
}

Must have had the postman plugin installed back then..
This post was edited by Twiebie (2010-10-02 00:17, 13 years ago)
GHengeveld
#8 2010-10-02 00:50
It's not really related to Cotonti, but I did write something on the topic recently: Sending email with python smtplib (it allows for a custom SMTP server)

There's probably a related PHP function somewhere.