Jump to content

problems sending email string


Recommended Posts

I have build an email system from a thread here at autoit.

It works fine to send static text.

I now want to read a string from file and write it to email but it doesn't work,

i have to convert it someway, anyone have an idea?

I got value from $var_original by doing an iniread and got for example:

09:21 ORDER "sl) Omx Sarlacc - Köp Trade - Grön - Krypterat OMXS300D" kurs 1034.7500$

When i do this in my test it works:

$var_original = '09:21 ORDER "sl) Omx Sarlacc - Köp Trade - Grön - Krypterat OMXS300D" kurs 1034.7500$'

but not when i do this:

$Subject = $var_original ; subject from the email - can be anything you want it to be

to send email by:

##################################

; Script

; ##################################

Global $oMyRet[2]

Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

$rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)

If @error Then

MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc)

EndIf

Can someone help me to get the value from varoriginal to subject with single dots?

:(

Link to comment
Share on other sites

If I understand you, you just need to read a value from a text file and send it with email?

If so, try some of this...

$arrayMax = _FileReadToArray ( $textFilePath, $arrayOfTextValues )

You will probably want to search the array for your value. Once you find that value, you know the Array index. Then just send that value to one of the variables used below in the SendMail Function. You might want to edit that function to pass less or more values, but a quick look at it should make sense.

Than I usually use the following function to email, keep in mind you need an INI file with a few values for this function to work.

;Sendmail Function
Func SendMail ( $emailSubject, $emailBody0, $emailBody2, $emailBody4, $emailBody5 )
    $s_FromAddress = IniRead ( $iniFile, "Mail", "1", "Error" )
    $s_ToAddress =   IniRead ( $iniFile, "Mail", "2", "Error" )
    $s_SmtpServer =  IniRead ( $iniFile, "Mail", "3", "Error" )
    $s_FromName = "Registry Script Notifications - DO NOT REPLY"
    $s_Subject = "DO NOT REPLY -- " & $emailSubject
    Dim $as_Body[7]
    $as_Body[0] = $emailBody0
    $as_Body[1] = ""
    $as_Body[2] = $emailBody2
    $as_Body[3] = ""
    $as_Body[4] = $emailBody4
    $as_Body[5] = ""
    $as_Body[6] = $emailBody5
    _INetSmtpMail ( $s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body )
EndFunc
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...