Solved

Using Synapse to send emails

Posted on 2006-07-05
10
1,874 Views
Last Modified: 2012-05-05
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
Comment
Question by:winexec
  • 3
  • 3
  • 2
  • +1
10 Comments
 
LVL 11

Expert Comment

by:calinutz
ID: 17048960
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
 
LVL 1

Author Comment

by:winexec
ID: 17050778
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
 
LVL 26

Expert Comment

by:EddieShipman
ID: 17051277
Seems your email CLIENT is the culprit here as it *should* handle the MultiPart/Mixed file
just fine.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 26

Expert Comment

by:EddieShipman
ID: 17051280
If that is what is showing in your email client, that is.
0
 
LVL 1

Author Comment

by:winexec
ID: 17051374
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
 
LVL 11

Expert Comment

by:calinutz
ID: 17053567
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
 
LVL 11

Expert Comment

by:calinutz
ID: 17053580
You should try requesting help from their website. They will probabely help you.
0
 
LVL 1

Author Comment

by:winexec
ID: 17054139
Thanks, it's fixed now, I should have been using another function, SendToRaw.
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 17983757
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question