[interchange-cvs] interchange - ton modified code/UserTag/email.tag

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Thu Feb 1 04:27:29 EST 2007


User:      ton
Date:      2007-02-01 09:27:28 GMT
Modified:  code/UserTag email.tag
Log:
	Extended Net::SMTP support.

	Before it was not possible to send email with attachments
	while using Net::SMTP as the mail agent.
	From now on the email tag does not rely on the email_raw
	tag anymore.

Revision  Changes    Path
1.13      +13 -3     interchange/code/UserTag/email.tag


rev 1.13, prev_rev 1.12
Index: email.tag
===================================================================
RCS file: /var/cvs/interchange/code/UserTag/email.tag,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- email.tag	8 Nov 2005 18:14:42 -0000	1.12
+++ email.tag	1 Feb 2007 09:27:27 -0000	1.13
@@ -1,6 +1,6 @@
 # Copyright 2002-2005 Interchange Development Group (http://www.icdevgroup.org/)
 # Licensed under the GNU GPL v2. See file LICENSE for details.
-# $Id: email.tag,v 1.12 2005/11/08 18:14:42 jon Exp $
+# $Id: email.tag,v 1.13 2007/02/01 09:27:27 ton Exp $
 
 UserTag email Order to subject reply from extra
 UserTag email hasEndTag
@@ -49,6 +49,8 @@
 	}
 	unshift @extra, "From: $from" if $from;
 
+	my $sent_with_attach = 0;
+
 	ATTACH: {
 #::logDebug("Checking for attachment");
 		last ATTACH unless $opt->{attach} || $opt->{html};
@@ -159,11 +161,19 @@
 			return $body;
 		}
 		else {
-			return $Tag->email_raw({}, $body);
+			$body =~ s/^(.+?)(?:\r?\n){2}//s;
+			my $headers = $1;
+			last SEND unless $headers;
+			my @head = split(/\r?\n/,$headers);
+
+			$ok = send_mail(\@head,$body);
+
+			$sent_with_attach = 1;
 		}
 	}
 
-	$ok = send_mail($to, $subject, $body, $reply, 0, @extra);
+	$ok = send_mail($to, $subject, $body, $reply, 0, @extra)
+			unless $sent_with_attach;
 
     if (!$ok) {
         logError("Unable to send mail using $Vend::Cfg->{SendMailProgram}\n" .








More information about the interchange-cvs mailing list