Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2046
  • Last Modified:

Using Synapse to send emails

Hi,

I'm trying Synapse to send emails with attachments and I use a function like this :

=========
var part: TMimePart;
   MM : TMimeMess;
   data:tstringlist;
   tmp: TMemoryStream;
=========
 data:=TStringList.Create;
 data.Add('This is a text');
 mm:=TMIMEMess.Create;
 mm.header.from:='me@email.com';
 mm.header.ToList.add('me@email.com');
 mm.header.subject:='A test';
 Part := mm.AddPartMultipart('Mixed', nil);
 mm.AddPartText(data, Part);
 tmp := TMemoryStream.Create;
 try
   tmp.LoadFromFile('C:\attachment.zip');
   mm.AddPartBinary(tmp, 'attachment.zip',part);
 finally
   tmp.Free;
 end;
 mm.EncodeMessage;
 SendToEx('me@email.com','me@email.com', 'Hey','smtp.email.com', MM.Lines, '','');
 MM.Free;
=========

The email is received, but looks like below:
=========
From: me@email.com
To: me@email.com
Subject: A test
Date: Wed, 5 Jul 2006 19:48:40 +0300
MIME-Version: 1.0 (produced by Synapse)
X-mailer: Synapse - Pascal TCP/IP library by Lukas Gebauer
Content-type: Multipart/Mixed; boundary="00538921_2DA5ADB8_Synapse_boundary"
Content-Description: Multipart message

--00538921_2DA5ADB8_Synapse_boundary
Content-type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: Quoted-printable
Content-Disposition: inline
Content-Description: Message text

This is a text
--00538921_2DA5ADB8_Synapse_boundary
Content-type: application/ZIP; name="attachment.zip"
Content-Transfer-Encoding: Base64
Content-Disposition: attachment; FileName="attachment.zip"
Content-Description: Attached file: attachment.zip

UEsDBBQAAAAIAIVVNDOt25sN/BoAAMJzAAAHAAAAZmFxLmh0be1dbVfbSJb+PJzT/6HacybY
GyMMTaZ3DCZLwKSZQKDB3Znes+fkyFbZ1iBLGkmGONn8933urRdJfsF2ArNfIN1gW6V7b926
73VLPhhmo+BwY+NgKF3vcOMgzSaBFJ0/rtqtSiY/Zdu9NK0cio0/dY7enLedfuCmQ/FF9KIg
SppiIoMgut8X/SBys6ZI/MEww7sozLb67sgPJk1xlPhuoD+7lxiAcd0o8PYFgd9yA38QNkVP
hplM9LDU/yybYmd3X9z5qd/1Az8DIH4N2r5uCCE6J04YJSM3yGn583GD/k2hz9xhNHKnAM8l
... ... ...
--00538921_2DA5ADB8_Synapse_boundary--
=========

Please tell me what is wrong or show me a working sample.

Thanks.
0
winexec
Asked:
winexec
  • 3
  • 3
  • 2
  • +1
1 Solution
 
calinutzCommented:
Why don't you try indy? It's simpler to use. These components do not seem to be able to send attachements other way than inline ones.

0
 
winexecAuthor Commented:
I want to keep my app as small as possible (no forms etc.).
I've heard good things about Synapse, are you sure isn't working with attachments?
0
 
EddieShipmanCommented:
Seems your email CLIENT is the culprit here as it *should* handle the MultiPart/Mixed file
just fine.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
EddieShipmanCommented:
If that is what is showing in your email client, that is.
0
 
winexecAuthor Commented:
Thanks Eddie, but I don't think it's my email client fault. I've tried webmails like Yahoo and Safe-mail.net, it happened the same thing :(
0
 
calinutzCommented:
It is not the email client.... The same result is shown with Outlook Express and directly in the webpage of the email server. It is just that it attaches the "attachement" in-line, that's what happens. Instead of attaching the file, it encrypts it and inserts the encryptet text intto the body.
  I read the source of the synapse and I did not see anything related to attaching files. I guess they stopped before solving this matter.

Regards
0
 
calinutzCommented:
You should try requesting help from their website. They will probabely help you.
0
 
winexecAuthor Commented:
Thanks, it's fixed now, I should have been using another function, SendToRaw.
0
 
Computer101Commented:
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now