Email attachments

Post

Posted
Rating:
#1 (In Topic #662)
Avatar
Guru
cogier is in the usergroup ‘Guru’
Does anybody know how to add an attachment to Gambas email?

The command

Code (gambas)

  1.  
  2. Email.Add(What do I put here?)
  3.  
  4.  
Email.Add
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Enthusiast
PJBlack is in the usergroup ‘Enthusiast’
 Methode   
Add ( Data As String [ , MimeType As String, Name As String ] )

Description
Adds an email attachment. Data is the data that usually comes directly from the file you want to attach. MimeType is the MIME type of the attached data. By default it is 'text/plain'. Name is the name of the attachment. It is automatically generated if not specified. Currently not all MIME types are supported.

Beschreibung
Fügt einen EMail-Anhang hinzu. Data sind die Daten, die in der Regel direkt aus der Datei kommen, die Sie anhängen möchten. MimeType ist der MIME-Typ der angehängten Daten. Standardmäßig ist es 'text/plain'. Name ist der Name des Anhangs. Er wird automatisch generiert, wenn er nicht angegeben wurde. Gegenwärtig werden nicht alle MIME-Typen unterstützt.

copy/paste from gambas-buch 24.4.0.2

EDIT

I#ve seen that hans just translated the wiki text … sorry
Online now: No Back to the top

Post

Posted
Rating:
#3
Avatar
Guru
cogier is in the usergroup ‘Guru’
Thanks PJBlack but  I have seen that information.

I have tried: -

Code (gambas)

  1. Email.Add("/tmp/Booking.csv", "text/csv")

and

Code (gambas)

  1. Email.Add(sNew.Join(gb.NewLine), "text/csv", "Booking.csv")

but neither work for me, the email is sent but not with any attachment.
Online now: No Back to the top

Post

Posted
Rating:
#4
Avatar
Enthusiast
PJBlack is in the usergroup ‘Enthusiast’
did you tried:

Code (gambas)

  1. Email.Add(File.Load("/tmp/Booking.csv"),"text/comma-separated-values",File.Name("/tmp/Booking.csv"))
Online now: No Back to the top

Post

Posted
Rating:
#5
Avatar
Guru
cogier is in the usergroup ‘Guru’
OK I have sorted this. My tip is don't set SmtpClient.Alternative value to True.

The mime text/csv now works fine.

Thanks for the input.
Online now: No Back to the top
1 guest and 0 members have just viewed this.