Jump to content
Sign in to follow this  

send URL with _INetSmtpMail

Recommended Posts



i have an unexpected behavior with _INetSmtpMail...

When Body parameter contains "http://" no e-mail is sent ! no error message neither. Everything seems OK but the message doesn't arrive.

If I change something in that Body so there is no more "http://" inside (one character less is enough) then everything is all right : the e-mail is properly sent.

:? :shock: :!:

Try it (some may need to adapt the code with specific SMTP or ISPs to change the HELO or use a password):

#include <INet.au3>

$s_SmtpServer = "smtp." ; to be completed
$s_FromName = "" ;  to be completed
$s_FromAddress = "" ;  to be completed
$s_ToAddress = ""; yours
Dim $t_Body[1]
$t_Body[0] = "http://"
$s_Subject = "just a try" 

if _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $t_Body) Then
    msgbox(0,"OK","no error")

Does anyone has the same problem ? or does someone has an idea ? a solution ?

Thanks !

PS/ when using $b_trace option in _INetSmtpMail, then everything always seems to be ok, each time, even when the e-mail is not received (ie when http:// is in the body). Only the body string changes : I expected the e-mail to be abble to send any body string. It's not.

Share this post

Link to post
Share on other sites

interesting, and very weird !

I was thinking about the function by itself, maybe a problem when encoding the body. But, the fact is the SMTP server answers "OK"... So, might look for an other source for the problem.

I hope anyone (myself, someone else) will find where the problem is. I wish to use that possibility.

Share this post

Link to post
Share on other sites

Have you tried to send the body as HTML?

<a href="http://www.google.com">Click me!</a>

I don't really know how it works in Autoit, but in PHP you can add extra headers like Content-Type and MIME-Version to treat it as HTML.

Edit: I just looked at the source in INet.au3, if you modify if some it might work.

$s_Send[4] =    "From:" & $s_FromName & "<" & $s_FromAddress & ">" & @CRLF & _
            "To:" & "<" & $s_ToAddress & ">" & @CRLF & _
            "Subject:" & $s_Subject & @CRLF & _
            "Mime-Version: 1.0" & @CRLF & _
            "Date: " & _DateDayOfWeek(@WDAY, 1) & ", " & @MDAY & " " & _DateToMonth(@MON, 1) & " " & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & $bias & @CRLF & _
            "Content-Type: text/plain; charset=US-ASCII" & @CRLF & _

Change the Content-Type to the following:

Content-Type: text/html; charset="ISO-8859-1";
Edited by Pain

Share this post

Link to post
Share on other sites


then answer is OK, BUT...

This DOES send any body, even if it contains http:// ...

Thanks for that yet. Then do you know why this is required ? (because i can send some with my usual e-mail client ! It looks like a filter done by the ISP with the outgoing e-mail, but it's not supposed to be and whatever, what difference between a script and my usual client ?) I also can receive such messages if they come from an other server.

And unfortunately it DOESN'T SOLVE the problem (my problem) because i need to send it in text (not html). It's... supposed to be an email to SMS gateway ( send by e-mail to a server wich redirect it to a cell phone ). So I need it to stay text.

that's too bad because otherwize your idea does work fine ! (that's still weird however)

BY THE WAY : no need to change the Inet file : just add the 3 html, body and a tags and it does send the email fine.

So, I'm still looking for help and/or a way to solve the problem. (I can not keep that tags inside a SMS.)

Edited by Lumi

Share this post

Link to post
Share on other sites

A way to solve my problem :

knowing, now, it's a filter problem on SMTP server, then i did try to add more lines after my text message. ( fortunately i can add a STOP sequence in the string so the SMS will STOP and be sent like i would like it to be).

Then added text after that won't change anything : but for the filter it did change everything. It's a size problem.

Well... i'm still surprised ! My problem is solved. But i'm surprise we can not send an URL to a friend ! (and because there is no error message... how can one know ? we think the URL is sent)

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

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.