PureSMTP library : mail & attachments (AUTH supported)
Moderator: gnozal
- doctorized
- Addict
- Posts: 882
- Joined: Fri Mar 27, 2009 9:41 am
- Location: Athens, Greece
- doctorized
- Addict
- Posts: 882
- Joined: Fri Mar 27, 2009 9:41 am
- Location: Athens, Greece
- doctorized
- Addict
- Posts: 882
- Joined: Fri Mar 27, 2009 9:41 am
- Location: Athens, Greece
PB wrote:Post the code you're using (and remove the login/password first).
Code: Select all
If OpenWindow(0, 300, 300, 260, 210,"Email Window", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered)
If CreateGadgetList(WindowID(0))
StringGadget(0,50,10,200,20,"");server
StringGadget(1,50,32,200,20,"");sender
StringGadget(2,50,54,200,20,"");taker
StringGadget(3,50,76,200,20,"");login name
StringGadget(4,50,98,200,20,"");login password
StringGadget(5,50,120,200,20,"");mail body
TextGadget(6,10,12,40,20,"smtp :")
TextGadget(7,10,34,40,20,"sender :")
TextGadget(8,10,56,40,20,"taker :")
TextGadget(9,10,78,40,20,"ID :")
TextGadget(10,10,100,40,20,"pass :")
TextGadget(11,10,122,40,20,"body :")
TextGadget(12,10,144,40,20,"interval :")
StringGadget(13,50,142,40,20,"30")
ButtonGadget(14,90,170,80,30,"OK with pass")
EndIf
Repeat
EventID = WaitWindowEvent()
If EventID = #PB_Event_CloseWindow
Quit = 1
ElseIf EventID = #PB_Event_Gadget
Select EventGadget()
Case 14
MySMTPServer.s = GetGadgetText(0)
MySMTPPort.l = 25
TimeOut.l = Val(GetGadgetText(13))
PureSMTP_SetTimeOut(TimeOut)
If PureSMTP_OpenSMTPConnection(MySMTPServer, MySMTPPort) = #PureSMTP_Ok
MailTo.s = GetGadgetText(2)
MailFrom.s = GetGadgetText(1)
Subject.s ="Hi!"
MsgBody.s = GetGadgetText(5)
Attachments.s
UserName.s = GetGadgetText(3)
Password.s = GetGadgetText(4)
Status.l = PureSMTP_SendMail(MailTo, MailFrom, Subject, MsgBody, Attachments, UserName, Password)
If Status = #PureSMTP_Ok
MessageRequester("sent:" + Str(Status),PureSMTP_GetLastServerMessage())
Else
MessageRequester("failed:" + Str(Status),PureSMTP_GetLastServerMessage())
EndIf
PureSMTP_CloseSMTPConnection()
Else
MessageRequester("OpenSMTPConnection failed",PureSMTP_GetLastServerMessage())
EndIf
EndSelect
EndIf
Until Quit = 1
EndIf
End
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Re: Spam mail
Maybe you could change the X-mailer ?doctorized wrote:I use the example code included in the zip file of PureSMTP lib and all the massages sent goes to the spam folder and not the inbox. Why?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
- doctorized
- Addict
- Posts: 882
- Joined: Fri Mar 27, 2009 9:41 am
- Location: Athens, Greece
Re: Spam mail
gnozal wrote:Maybe you could change the X-mailer ?doctorized wrote:I use the example code included in the zip file of PureSMTP lib and all the massages sent goes to the spam folder and not the inbox. Why?
Change it to what? I do not know what to give.
- doctorized
- Addict
- Posts: 882
- Joined: Fri Mar 27, 2009 9:41 am
- Location: Athens, Greece
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Re: Spam mail
To 'Lotus Notes Release 6.5.5 November 30, 2005' or 'Microsoft Office Outlook, Build 11.0.5510' for example, any well known mail client.doctorized wrote:Change it to what? I do not know what to give.gnozal wrote:Maybe you could change the X-mailer ?doctorized wrote:I use the example code included in the zip file of PureSMTP lib and all the massages sent goes to the spam folder and not the inbox. Why?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
And PureSMTP_SendMail() ?doctorized wrote:PureSMTP_GetLastServerMessage() returns nothing.gnozal wrote:The error code returned by PureSMTP_SendMail() as well as the PureSMTP_GetLastServerMessage() could help.
PureSMTP.chm wrote:Error codes :
#PureSMTP_FileError = -1
#PureSMTP_NoConnection = -2
#PureSMTP_BadResponse = - 3
#PureSMTP_MemoryAllocationProblem = -4
#PureSMTP_AuthentificationFailed = -5
#PureSMTP_ServerTimeOut = -6
#PureSMTP_Abort = -7
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
- doctorized
- Addict
- Posts: 882
- Joined: Fri Mar 27, 2009 9:41 am
- Location: Athens, Greece
PureSMTP_SendMail() returns -2.gnozal wrote:And PureSMTP_SendMail() ?doctorized wrote:PureSMTP_GetLastServerMessage() returns nothing.gnozal wrote:The error code returned by PureSMTP_SendMail() as well as the PureSMTP_GetLastServerMessage() could help.PureSMTP.chm wrote:Error codes :
#PureSMTP_FileError = -1
#PureSMTP_NoConnection = -2
#PureSMTP_BadResponse = - 3
#PureSMTP_MemoryAllocationProblem = -4
#PureSMTP_AuthentificationFailed = -5
#PureSMTP_ServerTimeOut = -6
#PureSMTP_Abort = -7
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
That means there is no current connection, i.e. PureSMTP_OpenSMTPConnection() failed or you called PureSMTP_CloseSMTPConnection(). This is strange, because in the code you posted, PureSMTP_SendMail() isn't called if PureSMTP_OpenSMTPConnection() failed.doctorized wrote:PureSMTP_SendMail() returns -2.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
- doctorized
- Addict
- Posts: 882
- Joined: Fri Mar 27, 2009 9:41 am
- Location: Athens, Greece
PureSMTP_SendMail() returns -2 if I cut the "If" from the PureSMTP_OpenSMTPConnection() so PureSMTP_SendMail() is called.gnozal wrote:That means there is no current connection, i.e. PureSMTP_OpenSMTPConnection() failed or you called PureSMTP_CloseSMTPConnection(). This is strange, because in the code you posted, PureSMTP_SendMail() isn't called if PureSMTP_OpenSMTPConnection() failed.
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
I guess PureSMTP_OpenSMTPConnection() fails because you have a corporate firewall / proxy at work, and unfortunately Purebasic network functions don't support proxies.
I have the same issue at work.
I have the same issue at work.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).