Solved

Using Synapse to send emails

Posted on 2006-07-05
10
1,838 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
 
LVL 26

Expert Comment

by:EddieShipman
ID: 17051280
If that is what is showing in your email client, that is.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Newbie Thread Programming 1 139
FMX enumerated colours 2 84
Working with hours 3 46
Need Help Delphi 2010 CheckBox1 Stored value in memo 13 57
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

896 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now