cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: Yahoo email with cURL

From: haroon ahmad <haroon_at_fastcreators.com>
Date: Sat, 25 Aug 2007 09:31:09 +0500

It is of course possible and I have seen such script that is used to send
emails using yahoo account. you need to do further http sniffing and watch
closely what variables are sent and checked while sending email after
reading your code I guess you are very close to it.

best of luck

Regards,
Haroon Ahmad
Sr. Web Developer
www.fastcreators.com

On 8/25/07, falcorthedog_at_ca.rr.com <falcorthedog_at_ca.rr.com> wrote:
>
> I've managed to write a PHP script that successfully logs into a user's
> Yahoo account and can download info such as their address book, etc.
>
> But I was wondering if it was possible to actually send an email from the
> user's Yahoo account using Yahoo's web based email system. I tried, but
> couldn't get it to work. Any ideas?
>
> Here is the code I tried:
>
> <?php
>
> $username = "username";
> $password = "password";
>
> $emailTo = "emailTo";
> $subject = "subject";
> $body = "body";
>
> $ch = curl_init();
>
> curl_setopt ($ch, CURLOPT_URL, 'http://login.yahoo.com/config/login?');
> curl_setopt ($ch, CURLOPT_POST, 1);
> curl_setopt ($ch, CURLOPT_POSTFIELDS,
> "login=$username&passwd=$password&.src=&.tries=5&.bypass=&.partner=&.md5=&.hash=&.intl=us&.tries=1&.challenge=
> ydKtXwwZarNeRMeAufKa56.oJqaO&.u=dmvmk8p231bpr&.yplus=&.emailCode=&pkg=&stepid=&.ev=&hasMsgr=0&.v=0&.chkP=N&.last=&.done=
> ");
>
> curl_setopt ($ch, CURLOPT_COOKIEJAR, "cookies.txt");
> curl_setopt ($ch, CURLOPT_COOKIEFILE, "cookies.txt");
>
> curl_setopt ($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Macintosh; U; PPC Mac
> OS X; en) AppleWebKit/419.2.1 (KHTML, like Gecko) Safari/419.3');
> curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
>
> curl_exec ($ch);
> //everything above works successfully and logs the user in (assuming
> correct name and password)... below is an unsuccessful attempt to send an
> email
>
> curl_setopt ($ch, CURLOPT_URL, '
> http://b7.mail.yahoo.com/ym/ziguana.com/Compose?');
> curl_setopt ($ch, CURLOPT_POSTFIELDS,
> "YY=6225&y5beta=yes&y5beta=yes&order=down&sort=date&view=a&To=$emailTo&Subj=$subject&body=$body");
>
> echo curl_exec ($ch);
>
> curl_close($ch);
> ?>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2007-08-25