ninj4n Posted April 15, 2009 Share Posted April 15, 2009 yeah i dont know the exact name of it. but im looking for something that'd make my program send the info entered in 2 text boxes directly to my email? how would i go about to do that ? Thanks in advance. Link to comment Share on other sites More sharing options...
Squirrely1 Posted April 15, 2009 Share Posted April 15, 2009 Here is something I wrote about 4 months ago - since then JdeB or Jos or someone came up with a probably better version - but this has worked for me... expandcollapse popup;#include <INet.au3> _SendMail("mailhost.worldnet.att.net", "Squirrel <meMyself@whereNot.net>", _ "Nut-gatherer <anotherPlace@squirels.com>", "Sq Biz", "", "", "C:\sqMail.htm") ; #FUNCTION# ======================================================================================= ; Name...........: _SendMail ; Description....: Calls the appropriate loop function, depending on the value of $_SS_Mode ; Syntax.........: ; ; _SendMail($sSmtpServer, $sToAddress, $sFromAddress, $sSubject, $sPlainTextBody, $sHtmlBody, $sLocalMhtmlFilepath, $sAttachmentFilepath, $sCarboncopyAddress, $sBlindCC ) ; ; Parameters.....: $sSmtpServer - "my.outgoing.smtp.server" ; $sToAddress - "Manadar <manadar@autoit.net>" ; $sFromAddress - "Squirrely1 <meMyself@myDomain.net>" ; $sSubject - Email's subject line - can contain no @CR's ; $sPlainTextBody - plain text as the body of the email ; $sHtmlBody - Html string as the body of the email - can contain @CRLF's ; $sLocalMhtmlFilepath - Mhtml file as the body of the email ; $sAttachmentFilepath - Attachments: "\\server\filefolder\FTPlog.TXT" or local file shortnamed ; $sCarboncopyAddress - CC's ; $sBlindCC - BCC's ; ; Return values .: (None.) ; ; Author.........: Lewis Roberts, Squirrely1 ; Modified.......: ; Remarks........: If youre sending the same message to more than one person, separate email ; address strings with commas in $sToAddress. ; ; Related........: _SS_SetTestLoopFunc, _SS_SetConfigLoopFunc, _SS_SetInstallLoopFunc, _SS_GUICreate, __TimeInTicksOf_LastUserInput . ; Link...........; http://www.lewisroberts.com/2006/06/09/sending-cdomessage-with-importance/ ; Example........; ; Reference......; INet.au3 ;=================================================================================================== Func _SendMail($sSmtpServer, $sToAddress, $sFromAddress = "", $sSubject = "", _ $sPlainTextBody = "", $sHtmlBody = "", $sLocalMhtmlFilepath = "", _ $sAttachmentFilepath = "", $sCarboncopyAddress = "", $sBlindCC = "") Local $objMail, $cdoConf, $sMhtmlFile, $sch $objMail = ObjCreate("CDO.Message") If @error Then Return SetError(1, 0, 0) $cdoConf = ObjCreate("CDO.Configuration") If @error Then Return SetError(1, 0, 0) With $objMail .From = $sFromAddress .To = $sToAddress .Subject = $sSubject Select Case StringLen($sPlainTextBody) .TextBody = $sPlainTextBody Case StringLen($sHtmlBody) .HTMLBody = $sHtmlBody; = "<h1>This is a message.</h1>" Case StringLen($sLocalMhtmlFilepath) If FileExists($sLocalMhtmlFilepath) Then; ; $sMhtmlFile = "file://" & StringLower(StringReplace(_INetExplorerCapable($sLocalMhtmlFilepath), "\", "/")) $sMhtmlFile = "file://" & StringLower(StringReplace($sLocalMhtmlFilepath, "\", "/")) ConsoleWrite(@CR & $sMhtmlFile & @CR) ;.CreateMHTMLBody "file://c:/mydocuments/test.htm" ... .CreateMHTMLBody($sMhtmlFile); Send an mhtml file as the body. EndIf EndSelect If StringLen($sAttachmentFilepath) Then .AddAttachment($sAttachmentFilepath) EndIf If StringLen($sCarboncopyAddress) Then .CC = $sCarboncopyAddress EndIf If StringLen($sBlindCC) Then .Bcc = $sBlindCC EndIf ;ConsoleWrite(@CR & .TextBody & @CR) ;ConsoleWrite(@CR & .HTMLBody & @CR) ;ConsoleWrite(@CR & .From & @CR) ;ConsoleWrite(@CR & .To & @CR) ;ConsoleWrite(@CR & .Subject & @CR) ; .AddAttachment("c:\mydocuments\test.txt") ; .CreateMHTMLBody("file://c:/mydocuments/test.htm"); Send an email as the body. ; EndWith $sch = "http://schemas.microsoft.com/cdo/configuration/" $cdoConf.Fields.Item($sch & "sendusing") = 2 ; $cdoConf.Fields.Item($sch & "smtpconnectiontimeout") = 480; 8 minutes? ; $cdoConf.Fields.Item($sch & "smtptimeout") = 480; 8 minutes? $cdoConf.Fields.Item($sch & "smtpserver") = $sSmtpServer; "mailhost.worldnet.att.net"; "my.outgoing.smtp.server" $cdoConf.Fields.Item($sch & "smtpserverport") = 25 $cdoConf.Fields.Item($sch & "smtpauthenticate") = 0 $cdoConf.Fields.Update $objMail.Configuration = $cdoConf $objMail.Fields.Item("urn:schemas:mailheader:X-MSMail-Priority") = "High"; For Outlook 2003. $objMail.Fields.Item("urn:schemas:mailheader:X-Priority") = 2; For Outlook 2003. $objMail.Fields.Item("urn:schemas:httpmail:importance") = 2; For Outlook Express. $objMail.Fields.Update $objMail.Send; Send the email. Sleep(220) $objMail = 0; Clean-up the mail objects ... $cdoConf = 0 Sleep(380) EndFunc Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
microera Posted August 9, 2009 Share Posted August 9, 2009 Hi Can you give me solution with sending email true Outlook Express! Email have sometime 1 to max. 6x .JPG pictures as attachment! T H A N K S! Link to comment Share on other sites More sharing options...
microera Posted August 10, 2009 Share Posted August 10, 2009 HiCan you give me solution with sending email true Outlook Express!Email have sometime 1 to max. 6x .JPG pictures as attachment!T H A N K S!I test example with one attachment like that:_SendMail("smtp.siol.net", "to_email@siol.net", _ "from_email@siol.net", "predmet/Subject", "plain_text", "", "","D:\tmp\GARMIN_Nuvi_GPS.jpg","","bcc_email@microera.si")and work OK!But is possible example with more attachments?!This is imported for me!What mean $sch variable in example? $sch = "http://schemas.microsoft.com/cdo/configuration/"thanks for helping me! Link to comment Share on other sites More sharing options...
microera Posted August 17, 2009 Share Posted August 17, 2009 Can anybody answer me: how to check if email was sent successfuly? Link to comment Share on other sites More sharing options...
Softieware Posted August 17, 2009 Share Posted August 17, 2009 Can anybody answer me: how to check if email was sent successfuly?maybe you can see for this: " Smtp Mailer That Supports Html And Attachments. Also Secure SMTP mail (GMail)".a nice working email-UDF Link to comment Share on other sites More sharing options...
Juvigy Posted August 17, 2009 Share Posted August 17, 2009 You can check by sending mail to yourself. For Outlook try this: Local $olMailItem = 0 Local $olFormatRichText = 3 Local $olImportanceLow = 0 Local $olImportanceNormal = 1 Local $olImportanceHigh = 2 Local $olByValue = 1 Local $olFormatHTML = 1 $oOApp = ObjCreate("Outlook.Application") $oOMail = $oOApp.CreateItem ($olMailItem) $oOMail.Save With $oOMail .To = ($mail) .Subject = $subject .BodyFormat = $olFormatHTML .Importance = $olImportanceNormal .HTMLBody = "mail body" .attachments.add ($FileName) .Send EndWith It is not tested with Express but works well with Outlook. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now