Smtp Mailer That Supports Html And Attachments.

658 posts in this topic

#41 ·  Posted

I do not get any errors now...but I need to know what to write in every variable...because it doesen't send any mail...

Code should look something like this....

Global $oMyRet[2]
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
$rc = _INetSmtpMailCom("MailServer", "Your Name", "your@Email.Address.com", "CCadress1@test.com;CCadress2@test.com", "Test Subject", "Test <b>Body</b>", "test.au3;test3.au3")
If @error then 
    msgbox(0,"Error sending message","Error code:" & @error & "  Description:" & $rc)
EndIf

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites



#42 ·  Posted

This what I don't get... :P What am I supposed to write in here...not good at english :nuke: CCadress1@test.com;CCadress2@test.com

Share this post


Link to post
Share on other sites

#43 ·  Posted (edited)

This what I don't get... :P What am I supposed to write in here...not good at english :nuke: CCadress1@test.com;CCadress2@test.com

just "" if there are no CC's for the message or in the format as described when you have CC's for the message. Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#44 ·  Posted

when I try and attach a file I get an error similar to this one saying the _PathFull function does not exist..

C:\Documents and Settings\User\Desktop\mail.au3(25,65) : ERROR: _PathFull(): undefined function.

I copied that text from scite as it was easier for me, I am aware that running it from scite could cause problems, but any way I have tried (context menu compile, even the compile script to exe in start menu) I just get the same problem. I am also using the latest beta version (downloaded today)

here's my config...

$rc = _INetSmtpMailCom("mail.***.com", "My Name", "My@Email.com", "Recipients@Email.com", "Test Subject", "Test <b>Body</b>", "test.txt")

can anyone help?

Share this post


Link to post
Share on other sites

#45 ·  Posted (edited)

when I try and attach a file I get an error similar to this one saying the _PathFull function does not exist..

Add this line at the top of your script.....

#Include<file.au3>

Updated original post.

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#46 ·  Posted

thanks JdeB, works a treat now :P

Share this post


Link to post
Share on other sites

#47 ·  Posted (edited)

Hey JdeB,

i tried to document this stuff you made a bit and changed the first lines to this

;##################################
; Include
;##################################
#Include<file.au3>

;##################################
; Variables
;##################################
$s_SmtpServer = "MailServer" ; address for the smtp-server to use - REQUIRED
$s_FromName = "Bot-user" ; name from who the email was sent
$s_FromAddress = "your@Email.Address.com" ;  address from where the mail should come
$s_ToAddress = "your@Email.Address.com" ; destination address of the email - REQUIRED
$s_Subject = "Userinfo" ; subject from the email - can be anything you want it to be
$as_Body = "" ; the messagebody from the mail - can be left blank but then you get a blank mail
$s_AttachFiles = "" ; the file you want to attach- leave blank if not needed
$s_CcAddress = "CCadress1@test.com" ; address for cc - leave blank if not needed
$s_BccAddress = "BCCadress1@test.com" ; address for bcc - leave blank if not needed
$s_Username = "******" ; username for the account used from where the mail gets sent - REQUIRED
$s_Password = "********" ; password for the account used from where the mail gets sent - REQUIRED
$IPPort=25 ; port used for sending the mail
$ssl=0 ; enables/disables secure socket layer sending - put to 1 if using httpS

;##################################
; Script
;##################################
Global $oMyRet[2]
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
$rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, $s_AttachFiles, $s_CcAddress, $s_BccAddress, $s_Username, $s_Password, $IPPort, $ssl)
If @error then 
    msgbox(0,"Error sending message","Error code:" & @error & "  Description:" & $rc)
EndIf

Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Username = "", $s_Password = "",$IPPort="", $ssl="")
    $objEmail = ObjCreate("CDO.Message")
    $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
    $objEmail.To = $s_ToAddress
    Local $i_Error = 0
oÝ÷ Ûb쨺½ý²â)Ú+ºÚ"µÍÒ[ÛYIÙ[K]LÉÝÂÛØ[    ÌÍÛÓ^T]ÌBÛØ[ ÌÍÛÓ^QÜHØ][
    ][ÝÐ]]Ò]Ü][ÝË ][ÝÓ^Q[É][ÝÊBÌÍÜÈHÒS]Û]XZ[ÛÛJ  ][ÝÓXZ[Ù][ÝË   ][ÝÖ[Ý[YI][ÝË  ][ÝÞ[Ý[XZ[YÜËÛÛI][ÝË   ][ÝÐÐØYÜÌPÝÛÛNÐÐØYÜÌÝÛÛI][ÝË ][ÝÕÝÝXXÝ  ][ÝË  ][ÝÕÝ    ØÝÐÙIËØÝÉ][ÝË ][ÝÝÝ]LÎÝÝË]LÉ][ÝÊBYÜ[ÙØÞ
    ][ÝÑÜÙ[[ÈYÜØYÙI][ÝË   ][ÝÑÜÛÙN][ÝÈ [ÈÜ   [È ][ÝÈØÜ[Û][ÝÈ [È ÌÍÜÊB[Y[ÈÒS]Û]XZ[ÛÛJ   ÌÍÜ×ÔÛ]Ù ÌÍÜ×ÑÛS[YK    ÌÍÜ×ÑÛPYÜË  ÌÍÜ×ÕÐYÜË   ÌÍÜ×ÔÝXXÝH   ][ÝÉ][ÝË    ÌÍØ×ÐÙHH  ][ÝÉ][ÝË    ÌÍÜ×Ð]XÚ[ÈH  ][ÝÉ][ÝË    ÌÍÜ×ÐØÐYÜÈH    ][ÝÉ][ÝË    ÌÍÜ×ÐØÐYÜÈH    ][ÝÉ][ÝË    ÌÍÜ×ÕÙ[YHH    ][ÝÉ][ÝË    ÌÍÜ×ÔÜÝÛÜH ][ÝÉ][ÝË    ÌÍÒTÜLK ÌÍÜÜÛL
B   ÌÍÛØ[XZ[HØÜX]J    ][ÝÐÑËYÜØYÙI][ÝÊB  ÌÍÛØ[XZ[ÛHH    ÌÎNÉ][ÝÉÌÎNÈ    [È ÌÍÜ×ÑÛS[YH    [È ÌÎNÉ][ÝÈ   ÉÌÎNÈ   [È ÌÍÜ×ÑÛPYÜÈ  [È ÌÎNÉÝÉÌÎN  ÌÍÛØ[XZ[ÈH ÌÍÜ×ÕÐYÜÂØØ[  ÌÍÚWÑÜH

All I changed was the $rc line in the script and placed all the variables together in a easier way (atleast for a noob like me)

It could save a few questions :nuke::P

one question however...>Exit code: 0 Time: 24.603 <- could it be...? 24 secs to send a mail. Kinda long, aint it?

and THX for this great emailer!!

Kind Regards,

Overlord

Edited by Overlord

Share this post


Link to post
Share on other sites

#48 ·  Posted

Oh nee!!! ene van antwerpen hier :P


Sapiente vince, rex, noli vincere ferro!

Share this post


Link to post
Share on other sites

#49 ·  Posted

Can I send to hotmail with this? I'm retarded when it comes to internet functions. :P

Share this post


Link to post
Share on other sites

#50 ·  Posted (edited)

@ Mosquitos : jup!! kwas eerst ne wereldburger ma heb dan toch maar besloten om die antwerpenaren ne keer plat op hun dak te laten gaan :P

@ Hallman :

read my changes and included documentation...

$s_ToAddress = "your@Email.Address.com" ; destination address of the email - REQUIRED

so yes you can use it to whatever address you want to reach.

all you need is the address from a smtp-server, the required login and password to get the mail send.

pm me if you need more help. It could take a day or 2 before I respond but I'll run you through it.

EDIT: btw, sending now takes only 2.065 seconds. Looks like my pc was busy with something else also at the time...

Edited by Overlord

Share this post


Link to post
Share on other sites

#51 ·  Posted (edited)

It sends the mail but it doesen't send the attachment

My code looks like this...I have the attachment in the same folder with the script

#Include<file.au3>

$s_SmtpServer = "smtp.gmail.com"; address for the smtp-server to use - REQUIRED
$s_FromName = "Kreatorul"; name from who the email was sent
$s_FromAddress = "Kreatorul@gmail.com";  address from where the mail should come
$s_ToAddress = "kreator_of_hell@yahoo.com"; destination address of the email - REQUIRED
$s_Subject = "Userinfo"; subject from the email - can be anything you want it to be
$as_Body = "txtfile"; the messagebody from the mail - can be left blank but then you get a blank mail
$s_AttachFiles = "eu.txt"; the file you want to attach- leave blank if not needed
$s_CcAddress = ""; address for cc - leave blank if not needed
$s_BccAddress = ""; address for bcc - leave blank if not needed
$s_Username = "Kreatorul@gmail.com"; username for the account used from where the mail gets sent - REQUIRED
$s_Password = "mypass"; password for the account used from where the mail gets sent - REQUIRED
$IPPort=465; port used for sending the mail
$ssl=1; enables/disables secure socket layer sending - put to 1 if using httpS

Global $oMyRet[2]
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
$rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, "")
If @error then
    msgbox(0,"Error sending message","Error code:" & @error & "  Description:" & $rc)
EndIf

Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "Userinfo", $as_Body = "txtfile", $s_AttachFiles = "eu.txt", $s_CcAddress = "", $s_BccAddress = "", $s_Username = "Kreatorul@gmail.com", $s_Password = "mypass",$IPPort=465, $ssl=1)
Edited by Kreatorul

Share this post


Link to post
Share on other sites

#52 ·  Posted

I dunno what could be the problem.

If you look at the original code JdeB sends his attachment as test.au3;test3.au3.

maybe that could be the problem.

else try includine @scriptdir and then the attachment.

JdeB should be able to answer this.

It could be that I missed something with the varaibles also...

try with the original script and then try again like I edited it. That could tell you something

Share this post


Link to post
Share on other sites

#53 ·  Posted

First of all: you shouldn't change the parameter defaults in the Func statement.

Other than that, i don't see any errors in the settings you have done.

A single file should work fine too...


Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#54 ·  Posted (edited)

something very strange happened today.

Today a friend of me got errorcode 2: transportfunction can't connect to the server.

EDIT: this friend is using the same script as me but uses a different isp.

Any ideas?

change ports?

is there a smtp-server that I can use always if this is the problem?

EDIT AGAIN: was my explanation of the variables atleast correct?

Edited by Overlord

Share this post


Link to post
Share on other sites

#55 ·  Posted (edited)

something very strange happened today.

Today a friend of me got errorcode 2: transportfunction can't connect to the server.

EDIT: this friend is using the same script as me but uses a different isp.

Any ideas?

change ports?

is there a smtp-server that I can use always if this is the problem?

Are you sure he used a correct SMTP server name and valid username/emailaddress ?

EDIT AGAIN: was my explanation of the variables atleast correct?

Looks nice !.. I copied it to my copy of the UDF Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#56 ·  Posted

Are you sure he used a correct SMTP server name and valid username/emailaddress ?

Looks nice !.. I copied it to my copy of the UDF

he used my compiled script...

I did send him the compiled version and it works with me.

Share this post


Link to post
Share on other sites

#57 ·  Posted

I still can't get the attachement to work..but for: errorcode 2: transportfunction can't connect to the server....if you use Gmail you need to have port 465 and ssl activated...

Share this post


Link to post
Share on other sites

#58 ·  Posted

I still can't get the attachement to work..but for: errorcode 2: transportfunction can't connect to the server....if you use Gmail you need to have port 465 and ssl activated...

Just tested it to make sure and it worked fine ... try to specify the file with its full path to see if that works.

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#59 ·  Posted (edited)

here are my variables:

$s_SmtpServer = "smtp.scarlet.be" ; address for the smtp-server to use - REQUIRED

$s_FromName = "Bot-user" ; name from who the email was sent

$s_FromAddress = "your@Email.Address.com" ; address from where the mail should come

$s_ToAddress = "Overlordtaw@gmail.com" ; destination address of the email - REQUIRED

$s_Subject = "Userinfo" ; subject from the email - can be anything you want it to be

$as_Body = "" the messagebody from the mail - can be left blank but then you get a blank mail

$s_AttachFiles = "" ; the file you want to attach - leave blank if not needed

$s_CcAddress = "" ; address for cc - leave blank if not needed

$s_BccAddress = "" ; address for bcc - leave blank if not needed

$s_Username = "ks426582" ; username for the account used from where the mail gets sent - REQUIRED

$s_Password = "ks349561" ; password for the account used from where the mail gets sent - REQUIRED

$IPPort=25 ; port used for sending the mail

$ssl=0 ; enables/disables secure socket layer sending - put to 1 if using httpS

NOTE: I changed my username and password to something else! this is not my real username and password but at my place it works...

why not at his?

Edited by Overlord

Share this post


Link to post
Share on other sites

#60 ·  Posted (edited)

here are my variables:

NOTE: I changed my username and password to something else! this is not my real username and password but at my place it works...

why not at his?

Is he using the same provider ?

In general , providers do not allow message relaying from other domain email addresses or other providers Ip addresses ....

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now