Solved

Using Synapse to send emails

Posted on 2006-07-05
10
1,818 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
If that is what is showing in your email client, that is.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 1

Author Comment

by:winexec
Comment Utility
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
Comment Utility
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
Comment Utility
You should try requesting help from their website. They will probabely help you.
0
 
LVL 1

Author Comment

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

Accepted Solution

by:
Computer101 earned 0 total points
Comment Utility
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

9 Experts available now in Live!

Get 1:1 Help Now